OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/frames.h" | 10 #include "src/frames.h" |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 Handle<Context> native_context = Handle<Context>(context->native_context()); | 391 Handle<Context> native_context = Handle<Context>(context->native_context()); |
392 | 392 |
393 // Check if native context allows code generation from | 393 // Check if native context allows code generation from |
394 // strings. Throw an exception if it doesn't. | 394 // strings. Throw an exception if it doesn't. |
395 if (native_context->allow_code_gen_from_strings()->IsFalse() && | 395 if (native_context->allow_code_gen_from_strings()->IsFalse() && |
396 !CodeGenerationFromStringsAllowed(isolate, native_context)) { | 396 !CodeGenerationFromStringsAllowed(isolate, native_context)) { |
397 Handle<Object> error_message = | 397 Handle<Object> error_message = |
398 native_context->ErrorMessageForCodeGenerationFromStrings(); | 398 native_context->ErrorMessageForCodeGenerationFromStrings(); |
399 Handle<Object> error; | 399 Handle<Object> error; |
400 MaybeHandle<Object> maybe_error = isolate->factory()->NewEvalError( | 400 MaybeHandle<Object> maybe_error = isolate->factory()->NewEvalError( |
401 MessageTemplate::kCodeGenFromStrings, error_message); | 401 "code_gen_from_strings", HandleVector<Object>(&error_message, 1)); |
402 if (maybe_error.ToHandle(&error)) isolate->Throw(*error); | 402 if (maybe_error.ToHandle(&error)) isolate->Throw(*error); |
403 return MakePair(isolate->heap()->exception(), NULL); | 403 return MakePair(isolate->heap()->exception(), NULL); |
404 } | 404 } |
405 | 405 |
406 // Deal with a normal eval call with a string argument. Compile it | 406 // Deal with a normal eval call with a string argument. Compile it |
407 // and return the compiled function bound in the local context. | 407 // and return the compiled function bound in the local context. |
408 static const ParseRestriction restriction = NO_PARSE_RESTRICTION; | 408 static const ParseRestriction restriction = NO_PARSE_RESTRICTION; |
409 Handle<JSFunction> compiled; | 409 Handle<JSFunction> compiled; |
410 ASSIGN_RETURN_ON_EXCEPTION_VALUE( | 410 ASSIGN_RETURN_ON_EXCEPTION_VALUE( |
411 isolate, compiled, | 411 isolate, compiled, |
(...skipping 24 matching lines...) Expand all Loading... |
436 DCHECK(is_valid_language_mode(args.smi_at(4))); | 436 DCHECK(is_valid_language_mode(args.smi_at(4))); |
437 LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(4)); | 437 LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(4)); |
438 DCHECK(args[5]->IsSmi()); | 438 DCHECK(args[5]->IsSmi()); |
439 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), | 439 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), |
440 isolate); | 440 isolate); |
441 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, | 441 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, |
442 args.at<Object>(3), language_mode, args.smi_at(5)); | 442 args.at<Object>(3), language_mode, args.smi_at(5)); |
443 } | 443 } |
444 } | 444 } |
445 } // namespace v8::internal | 445 } // namespace v8::internal |
OLD | NEW |