OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 // Defined when linking against shared lib on Windows. | 6 // Defined when linking against shared lib on Windows. |
7 #if defined(USING_V8_SHARED) && !defined(V8_SHARED) | 7 #if defined(USING_V8_SHARED) && !defined(V8_SHARED) |
8 #define V8_SHARED | 8 #define V8_SHARED |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1081 .ToLocalChecked(); | 1081 .ToLocalChecked(); |
1082 ScriptOrigin origin(name); | 1082 ScriptOrigin origin(name); |
1083 Local<Script> script = | 1083 Local<Script> script = |
1084 Script::Compile(context, source, &origin).ToLocalChecked(); | 1084 Script::Compile(context, source, &origin).ToLocalChecked(); |
1085 stringify_function_.Reset( | 1085 stringify_function_.Reset( |
1086 isolate, script->Run(context).ToLocalChecked().As<Function>()); | 1086 isolate, script->Run(context).ToLocalChecked().As<Function>()); |
1087 } | 1087 } |
1088 Local<Function> fun = Local<Function>::New(isolate, stringify_function_); | 1088 Local<Function> fun = Local<Function>::New(isolate, stringify_function_); |
1089 Local<Value> argv[1] = {value}; | 1089 Local<Value> argv[1] = {value}; |
1090 v8::TryCatch try_catch(isolate); | 1090 v8::TryCatch try_catch(isolate); |
1091 MaybeLocal<Value> result = | 1091 MaybeLocal<Value> result = fun->Call(context, Undefined(isolate), 1, argv); |
1092 fun->Call(context, Undefined(isolate), 1, argv).ToLocalChecked(); | |
1093 if (result.IsEmpty()) return String::Empty(isolate); | 1092 if (result.IsEmpty()) return String::Empty(isolate); |
1094 return result.ToLocalChecked().As<String>(); | 1093 return result.ToLocalChecked().As<String>(); |
1095 } | 1094 } |
1096 #endif // !V8_SHARED | 1095 #endif // !V8_SHARED |
1097 | 1096 |
1098 | 1097 |
1099 Local<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) { | 1098 Local<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) { |
1100 Local<ObjectTemplate> global_template = ObjectTemplate::New(isolate); | 1099 Local<ObjectTemplate> global_template = ObjectTemplate::New(isolate); |
1101 global_template->Set( | 1100 global_template->Set( |
1102 String::NewFromUtf8(isolate, "print", NewStringType::kNormal) | 1101 String::NewFromUtf8(isolate, "print", NewStringType::kNormal) |
(...skipping 1451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2554 } | 2553 } |
2555 | 2554 |
2556 } // namespace v8 | 2555 } // namespace v8 |
2557 | 2556 |
2558 | 2557 |
2559 #ifndef GOOGLE3 | 2558 #ifndef GOOGLE3 |
2560 int main(int argc, char* argv[]) { | 2559 int main(int argc, char* argv[]) { |
2561 return v8::Shell::Main(argc, argv); | 2560 return v8::Shell::Main(argc, argv); |
2562 } | 2561 } |
2563 #endif | 2562 #endif |
OLD | NEW |