Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: src/builtins.cc

Issue 1903463002: Make global eval faster by lazily computing its call position. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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-arguments.h" 7 #include "src/api-arguments.h"
8 #include "src/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/api.h" 9 #include "src/api.h"
10 #include "src/base/once.h" 10 #include "src/base/once.h"
(...skipping 2049 matching lines...) Expand 10 before | Expand all | Expand 10 after
2060 if (native_context->allow_code_gen_from_strings()->IsFalse() && 2060 if (native_context->allow_code_gen_from_strings()->IsFalse() &&
2061 !CodeGenerationFromStringsAllowed(isolate, native_context)) { 2061 !CodeGenerationFromStringsAllowed(isolate, native_context)) {
2062 Handle<Object> error_message = 2062 Handle<Object> error_message =
2063 native_context->ErrorMessageForCodeGenerationFromStrings(); 2063 native_context->ErrorMessageForCodeGenerationFromStrings();
2064 THROW_NEW_ERROR(isolate, NewEvalError(MessageTemplate::kCodeGenFromStrings, 2064 THROW_NEW_ERROR(isolate, NewEvalError(MessageTemplate::kCodeGenFromStrings,
2065 error_message), 2065 error_message),
2066 JSFunction); 2066 JSFunction);
2067 } 2067 }
2068 2068
2069 // Compile source string in the native context. 2069 // Compile source string in the native context.
2070 StackTraceFrameIterator it(isolate);
2071 int eval_scope_position = 0; 2070 int eval_scope_position = 0;
2072 int eval_position = RelocInfo::kNoPosition; 2071 int eval_position = RelocInfo::kNoPosition;
2073 Handle<SharedFunctionInfo> outer_info; 2072 Handle<SharedFunctionInfo> outer_info(native_context->closure()->shared());
2074 if (!it.done() && it.is_javascript()) {
2075 FrameSummary summary = FrameSummary::GetFirst(it.javascript_frame());
2076 eval_position =
2077 summary.abstract_code()->SourcePosition(summary.code_offset());
2078 outer_info = Handle<SharedFunctionInfo>(summary.function()->shared());
2079 } else {
2080 outer_info =
2081 Handle<SharedFunctionInfo>(native_context->closure()->shared());
2082 }
2083 return Compiler::GetFunctionFromEval(source, outer_info, native_context, 2073 return Compiler::GetFunctionFromEval(source, outer_info, native_context,
2084 SLOPPY, restriction, eval_scope_position, 2074 SLOPPY, restriction, eval_scope_position,
2085 eval_position); 2075 eval_position);
2086 } 2076 }
2087 2077
2088 } // namespace 2078 } // namespace
2089 2079
2090 2080
2091 // ES6 section 18.2.1 eval (x) 2081 // ES6 section 18.2.1 eval (x)
2092 BUILTIN(GlobalEval) { 2082 BUILTIN(GlobalEval) {
(...skipping 3268 matching lines...) Expand 10 before | Expand all | Expand 10 after
5361 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T) 5351 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T)
5362 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) 5352 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H)
5363 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 5353 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
5364 #undef DEFINE_BUILTIN_ACCESSOR_C 5354 #undef DEFINE_BUILTIN_ACCESSOR_C
5365 #undef DEFINE_BUILTIN_ACCESSOR_A 5355 #undef DEFINE_BUILTIN_ACCESSOR_A
5366 #undef DEFINE_BUILTIN_ACCESSOR_T 5356 #undef DEFINE_BUILTIN_ACCESSOR_T
5367 #undef DEFINE_BUILTIN_ACCESSOR_H 5357 #undef DEFINE_BUILTIN_ACCESSOR_H
5368 5358
5369 } // namespace internal 5359 } // namespace internal
5370 } // namespace v8 5360 } // namespace v8
OLDNEW
« no previous file with comments | « src/accessors.cc ('k') | src/compiler.cc » ('j') | src/compiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698