| 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 #include "src/builtins.h" | 5 #include "src/builtins.h" |
| 6 | 6 |
| 7 #include "src/api.h" | 7 #include "src/api.h" |
| 8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
| 9 #include "src/api-natives.h" | 9 #include "src/api-natives.h" |
| 10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
| (...skipping 2050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2061 if (native_context->allow_code_gen_from_strings()->IsFalse() && | 2061 if (native_context->allow_code_gen_from_strings()->IsFalse() && |
| 2062 !CodeGenerationFromStringsAllowed(isolate, native_context)) { | 2062 !CodeGenerationFromStringsAllowed(isolate, native_context)) { |
| 2063 Handle<Object> error_message = | 2063 Handle<Object> error_message = |
| 2064 native_context->ErrorMessageForCodeGenerationFromStrings(); | 2064 native_context->ErrorMessageForCodeGenerationFromStrings(); |
| 2065 THROW_NEW_ERROR(isolate, NewEvalError(MessageTemplate::kCodeGenFromStrings, | 2065 THROW_NEW_ERROR(isolate, NewEvalError(MessageTemplate::kCodeGenFromStrings, |
| 2066 error_message), | 2066 error_message), |
| 2067 JSFunction); | 2067 JSFunction); |
| 2068 } | 2068 } |
| 2069 | 2069 |
| 2070 // Compile source string in the native context. | 2070 // Compile source string in the native context. |
| 2071 StackTraceFrameIterator it(isolate); | 2071 Handle<SharedFunctionInfo> outer_info(native_context->closure()->shared(), |
| 2072 int pos = RelocInfo::kNoPosition; | 2072 isolate); |
| 2073 Handle<SharedFunctionInfo> outer_info; | |
| 2074 if (!it.done() && it.is_javascript()) { | |
| 2075 FrameSummary summary = FrameSummary::GetFirst(it.javascript_frame()); | |
| 2076 pos = summary.abstract_code()->SourcePosition(summary.code_offset()); | |
| 2077 outer_info = Handle<SharedFunctionInfo>(summary.function()->shared()); | |
| 2078 } else { | |
| 2079 outer_info = | |
| 2080 Handle<SharedFunctionInfo>(native_context->closure()->shared()); | |
| 2081 } | |
| 2082 | |
| 2083 return Compiler::GetFunctionFromEval(source, outer_info, native_context, | 2073 return Compiler::GetFunctionFromEval(source, outer_info, native_context, |
| 2084 SLOPPY, restriction, pos); | 2074 SLOPPY, restriction, |
| 2075 RelocInfo::kNoPosition); |
| 2085 } | 2076 } |
| 2086 | 2077 |
| 2087 } // namespace | 2078 } // namespace |
| 2088 | 2079 |
| 2089 | 2080 |
| 2090 // ES6 section 18.2.1 eval (x) | 2081 // ES6 section 18.2.1 eval (x) |
| 2091 BUILTIN(GlobalEval) { | 2082 BUILTIN(GlobalEval) { |
| 2092 HandleScope scope(isolate); | 2083 HandleScope scope(isolate); |
| 2093 Handle<Object> x = args.atOrUndefined(isolate, 1); | 2084 Handle<Object> x = args.atOrUndefined(isolate, 1); |
| 2094 Handle<JSFunction> target = args.target<JSFunction>(); | 2085 Handle<JSFunction> target = args.target<JSFunction>(); |
| (...skipping 3225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5320 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T) | 5311 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T) |
| 5321 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 5312 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
| 5322 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 5313 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 5323 #undef DEFINE_BUILTIN_ACCESSOR_C | 5314 #undef DEFINE_BUILTIN_ACCESSOR_C |
| 5324 #undef DEFINE_BUILTIN_ACCESSOR_A | 5315 #undef DEFINE_BUILTIN_ACCESSOR_A |
| 5325 #undef DEFINE_BUILTIN_ACCESSOR_T | 5316 #undef DEFINE_BUILTIN_ACCESSOR_T |
| 5326 #undef DEFINE_BUILTIN_ACCESSOR_H | 5317 #undef DEFINE_BUILTIN_ACCESSOR_H |
| 5327 | 5318 |
| 5328 } // namespace internal | 5319 } // namespace internal |
| 5329 } // namespace v8 | 5320 } // namespace v8 |
| OLD | NEW |