1
1
diff --git a/BUILD.gn b/BUILD.gn
2
- index 1e31acb..1c7c170 100644
2
+ index 83f1fdb..2f3fe6d 100644
3
3
--- a/BUILD.gn
4
4
+++ b/BUILD.gn
5
- @@ -376,7 +376,7 @@ config("toolchain") {
6
- visibility = [ ":*" ] # Only targets in this file can depend on this.
7
-
8
- defines = []
9
- - cflags = []
10
- + cflags = [ "-Wno-deprecated-declarations" ]
11
- ldflags = []
12
-
13
- if (v8_current_cpu == "arm") {
14
- @@ -1493,6 +1493,8 @@ v8_source_set("v8_base") {
5
+ @@ -1535,6 +1535,8 @@ v8_source_set("v8_base") {
15
6
"include/v8-util.h",
16
7
"include/v8.h",
17
8
"include/v8config.h",
@@ -22,13 +13,13 @@ index 1e31acb..1c7c170 100644
22
13
"src/address-map.cc",
23
14
diff --git a/src/V8NativeScriptExtension.cc b/src/V8NativeScriptExtension.cc
24
15
new file mode 100644
25
- index 0000000..6d67650
16
+ index 0000000..7a49c4f
26
17
--- /dev/null
27
18
+++ b/src/V8NativeScriptExtension.cc
28
- @@ -0,0 +1,212 @@
19
+ @@ -0,0 +1,213 @@
29
20
+ #include "V8NativeScriptExtension.h"
30
21
+ #include "objects-inl.h"
31
- + #include "api.h"
22
+ + #include "api-inl .h"
32
23
+ #include "checks.h"
33
24
+ #include "contexts.h"
34
25
+ #include "globals.h"
@@ -109,9 +100,9 @@ index 0000000..6d67650
109
100
+ return h->address();
110
101
+ }
111
102
+
112
- + Local<Value>* NativeScriptExtension::GetClosureObjects(Isolate * isolate, const Local<Function>& func, int * length)
103
+ + Local<Value>* NativeScriptExtension::GetClosureObjects(Isolate* isolate, const Local<Function>& func, int* length)
113
104
+ {
114
- + unsafe_arr< Local<Value> > arr;
105
+ + unsafe_arr<Local<Value>> arr;
115
106
+
116
107
+ i::Handle<i::JSReceiver> receiver = Utils::OpenHandle(*func);
117
108
+
@@ -130,26 +121,27 @@ index 0000000..6d67650
130
121
+
131
122
+ i::ContextLookupFlags cxtFlags = i::FOLLOW_CHAINS;
132
123
+
133
- + if (( cxt != nullptr) && ( !cxt->IsNativeContext() ))
124
+ + if (cxt != nullptr && !cxt->IsNativeContext())
134
125
+ {
135
126
+ i::ScopeInfo *si = cxt->scope_info();
136
127
+
137
- + if (si != nullptr)
128
+ + if (si != nullptr && si->HasContext() )
138
129
+ {
139
130
+ int len = si->length();
140
131
+
141
132
+ for (int i = 0; i < len; i++)
142
133
+ {
143
134
+ i::Object *cur = si->get(i);
144
135
+
145
- + if (( cur != nullptr) && ( cur->IsString() ))
136
+ + if (cur != nullptr && cur->IsString())
146
137
+ {
147
138
+ i::String *s = i::String::cast(cur);
148
139
+
149
140
+ i::Handle<i::String> name = i::Handle<i::String>(s, internal_isolate);
150
141
+
151
142
+ i::PropertyAttributes attr;
152
- + i::InitializationFlag init_flag; i::VariableMode var_mode;
143
+ + i::InitializationFlag init_flag;
144
+ + i::VariableMode var_mode;
153
145
+ int idx;
154
146
+
155
147
+ i::Handle<i::Object> o = cxt->Lookup(name, cxtFlags, &idx, &attr, &init_flag, &var_mode);
@@ -178,11 +170,11 @@ index 0000000..6d67650
178
170
+
179
171
+ void NativeScriptExtension::ReleaseClosureObjects(Local<Value>* closureObjects)
180
172
+ {
181
- + unsafe_arr< Local<Value> >::release_data(closureObjects);
173
+ + unsafe_arr<Local<Value>>::release_data(closureObjects);
182
174
+ }
183
175
+
184
176
+
185
- + void NativeScriptExtension::GetAssessorPair(Isolate * isolate, const Local<Object>& obj, const Local<String>& propName, Local<Value>& getter, Local<Value>& setter)
177
+ + void NativeScriptExtension::GetAssessorPair(Isolate* isolate, const Local<Object>& obj, const Local<String>& propName, Local<Value>& getter, Local<Value>& setter)
186
178
+ {
187
179
+ i::Handle<i::JSObject> o = i::Handle<i::JSObject>::cast(Utils::OpenHandle(*obj));
188
180
+
@@ -210,7 +202,7 @@ index 0000000..6d67650
210
202
+ }
211
203
+
212
204
+
213
- + Local<Array> NativeScriptExtension::GetPropertyKeys(Isolate * isolate, const Local<Context>& context, const Local<Object>& object, bool& success)
205
+ + Local<Array> NativeScriptExtension::GetPropertyKeys(Isolate* isolate, const Local<Context>& context, const Local<Object>& object, bool& success)
214
206
+ {
215
207
+ success = true;
216
208
+
@@ -235,66 +227,38 @@ index 0000000..6d67650
235
227
+ }
236
228
+
237
229
+ void NativeScriptExtension::CpuFeaturesProbe(bool cross_compile) {
238
- + internal ::CpuFeatures::Probe(cross_compile);
230
+ + i ::CpuFeatures::Probe(cross_compile);
239
231
+ }
240
232
+
241
233
diff --git a/src/V8NativeScriptExtension.h b/src/V8NativeScriptExtension.h
242
234
new file mode 100644
243
- index 0000000..c7954f4
235
+ index 0000000..1111215
244
236
--- /dev/null
245
237
+++ b/src/V8NativeScriptExtension.h
246
- @@ -0,0 +1,22 @@
238
+ @@ -0,0 +1,23 @@
247
239
+ #include "v8.h"
240
+ + #include "api.h"
248
241
+
249
242
+ namespace v8 {
250
243
+
251
244
+ class NativeScriptExtension {
252
245
+ public:
253
246
+ static unsigned long GetAddress(const v8::Local<v8::Object>& obj);
254
247
+
255
- + static v8::Local<v8::Value>* GetClosureObjects(v8::Isolate * isolate, const v8::Local<v8::Function>& func, int * length);
248
+ + static v8::Local<v8::Value>* GetClosureObjects(v8::Isolate* isolate, const v8::Local<v8::Function>& func, int* length);
256
249
+
257
250
+ static void ReleaseClosureObjects(v8::Local<v8::Value>* closureObjects);
258
251
+
259
- + static void GetAssessorPair(v8::Isolate * isolate, const v8::Local<v8::Object>& obj, const v8::Local<v8::String>& propName, v8::Local<v8::Value>& getter, v8::Local<v8::Value>& setter);
252
+ + static void GetAssessorPair(v8::Isolate* isolate, const v8::Local<v8::Object>& obj, const v8::Local<v8::String>& propName, v8::Local<v8::Value>& getter, v8::Local<v8::Value>& setter);
260
253
+
261
- + static v8::Local<v8::Array> GetPropertyKeys(v8::Isolate * isolate, const v8::Local<v8::Context>& context, const v8::Local<v8::Object>& object, bool& success);
254
+ + static v8::Local<v8::Array> GetPropertyKeys(v8::Isolate* isolate, const v8::Local<v8::Context>& context, const v8::Local<v8::Object>& object, bool& success);
262
255
+
263
256
+ static void CpuFeaturesProbe(bool cross_compile);
264
257
+ private:
265
258
+ NativeScriptExtension();
266
259
+ };
267
260
+ }
268
261
+
269
- diff --git a/src/api.cc b/src/api.cc
270
- index 7c569e3..409bcb9 100644
271
- --- a/src/api.cc
272
- +++ b/src/api.cc
273
- @@ -551,8 +551,22 @@ bool RunExtraCode(Isolate* isolate, Local<Context> context,
274
- ScriptOrigin origin(resource_name);
275
- ScriptCompiler::Source source(source_string, origin);
276
- Local<Script> script;
277
- - if (!ScriptCompiler::Compile(context, &source).ToLocal(&script)) return false;
278
- - if (script->Run(context).IsEmpty()) return false;
279
- + if (!ScriptCompiler::Compile(context, &source).ToLocal(&script)) {
280
- + base::OS::PrintError("# Script compile failed in %s@%d:%d\n%s\n",
281
- + *String::Utf8Value(try_catch.Message()->GetScriptResourceName()),
282
- + try_catch.Message()->GetLineNumber(context).FromJust(),
283
- + try_catch.Message()->GetStartColumn(context).FromJust(),
284
- + *String::Utf8Value(try_catch.Exception()));
285
- + return false;
286
- + }
287
- + if (script->Run(context).IsEmpty()) {
288
- + base::OS::PrintError("# Script run failed in %s@%d:%d\n%s\n",
289
- + *String::Utf8Value(try_catch.Message()->GetScriptResourceName()),
290
- + try_catch.Message()->GetLineNumber(context).FromJust(),
291
- + try_catch.Message()->GetStartColumn(context).FromJust(),
292
- + *String::Utf8Value(try_catch.Exception()));
293
- + return false;
294
- + }
295
- if (i::FLAG_profile_deserialization) {
296
- i::PrintF("Executing custom snapshot script %s took %0.3f ms\n", name,
297
- timer.Elapsed().InMillisecondsF());
298
262
diff --git a/src/inspector/inspector_protocol_config.json b/src/inspector/inspector_protocol_config.json
299
263
index fa07312..d7e2cef 100644
300
264
--- a/src/inspector/inspector_protocol_config.json
0 commit comments