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

Side by Side Diff: src/runtime/runtime-compiler.cc

Issue 1888013002: Revert of Correctly annotate eval origin. (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 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/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.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-inl.h" 10 #include "src/frames-inl.h"
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 if (callback == NULL) { 298 if (callback == NULL) {
299 // No callback set and code generation disallowed. 299 // No callback set and code generation disallowed.
300 return false; 300 return false;
301 } else { 301 } else {
302 // Callback set. Let it decide if code generation is allowed. 302 // Callback set. Let it decide if code generation is allowed.
303 VMState<EXTERNAL> state(isolate); 303 VMState<EXTERNAL> state(isolate);
304 return callback(v8::Utils::ToLocal(context)); 304 return callback(v8::Utils::ToLocal(context));
305 } 305 }
306 } 306 }
307 307
308
308 static Object* CompileGlobalEval(Isolate* isolate, Handle<String> source, 309 static Object* CompileGlobalEval(Isolate* isolate, Handle<String> source,
309 Handle<SharedFunctionInfo> outer_info, 310 Handle<SharedFunctionInfo> outer_info,
310 LanguageMode language_mode, 311 LanguageMode language_mode,
311 int eval_position) { 312 int scope_position) {
312 Handle<Context> context = Handle<Context>(isolate->context()); 313 Handle<Context> context = Handle<Context>(isolate->context());
313 Handle<Context> native_context = Handle<Context>(context->native_context()); 314 Handle<Context> native_context = Handle<Context>(context->native_context());
314 315
315 // Check if native context allows code generation from 316 // Check if native context allows code generation from
316 // strings. Throw an exception if it doesn't. 317 // strings. Throw an exception if it doesn't.
317 if (native_context->allow_code_gen_from_strings()->IsFalse() && 318 if (native_context->allow_code_gen_from_strings()->IsFalse() &&
318 !CodeGenerationFromStringsAllowed(isolate, native_context)) { 319 !CodeGenerationFromStringsAllowed(isolate, native_context)) {
319 Handle<Object> error_message = 320 Handle<Object> error_message =
320 native_context->ErrorMessageForCodeGenerationFromStrings(); 321 native_context->ErrorMessageForCodeGenerationFromStrings();
321 Handle<Object> error; 322 Handle<Object> error;
322 MaybeHandle<Object> maybe_error = isolate->factory()->NewEvalError( 323 MaybeHandle<Object> maybe_error = isolate->factory()->NewEvalError(
323 MessageTemplate::kCodeGenFromStrings, error_message); 324 MessageTemplate::kCodeGenFromStrings, error_message);
324 if (maybe_error.ToHandle(&error)) isolate->Throw(*error); 325 if (maybe_error.ToHandle(&error)) isolate->Throw(*error);
325 return isolate->heap()->exception(); 326 return isolate->heap()->exception();
326 } 327 }
327 328
328 // Deal with a normal eval call with a string argument. Compile it 329 // Deal with a normal eval call with a string argument. Compile it
329 // and return the compiled function bound in the local context. 330 // and return the compiled function bound in the local context.
330 static const ParseRestriction restriction = NO_PARSE_RESTRICTION; 331 static const ParseRestriction restriction = NO_PARSE_RESTRICTION;
331 Handle<JSFunction> compiled; 332 Handle<JSFunction> compiled;
332 ASSIGN_RETURN_ON_EXCEPTION_VALUE( 333 ASSIGN_RETURN_ON_EXCEPTION_VALUE(
333 isolate, compiled, 334 isolate, compiled,
334 Compiler::GetFunctionFromEval(source, outer_info, context, language_mode, 335 Compiler::GetFunctionFromEval(source, outer_info, context, language_mode,
335 restriction, eval_position), 336 restriction, scope_position),
336 isolate->heap()->exception()); 337 isolate->heap()->exception());
337 return *compiled; 338 return *compiled;
338 } 339 }
339 340
340 341
341 RUNTIME_FUNCTION(Runtime_ResolvePossiblyDirectEval) { 342 RUNTIME_FUNCTION(Runtime_ResolvePossiblyDirectEval) {
342 HandleScope scope(isolate); 343 HandleScope scope(isolate);
343 DCHECK(args.length() == 5); 344 DCHECK(args.length() == 5);
344 345
345 Handle<Object> callee = args.at<Object>(0); 346 Handle<Object> callee = args.at<Object>(0);
(...skipping 12 matching lines...) Expand all
358 DCHECK(is_valid_language_mode(args.smi_at(3))); 359 DCHECK(is_valid_language_mode(args.smi_at(3)));
359 LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(3)); 360 LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(3));
360 DCHECK(args[4]->IsSmi()); 361 DCHECK(args[4]->IsSmi());
361 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), 362 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(),
362 isolate); 363 isolate);
363 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, 364 return CompileGlobalEval(isolate, args.at<String>(1), outer_info,
364 language_mode, args.smi_at(4)); 365 language_mode, args.smi_at(4));
365 } 366 }
366 } // namespace internal 367 } // namespace internal
367 } // namespace v8 368 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects-printer.cc ('k') | test/cctest/interpreter/bytecode_expectations/CallLookupSlot.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698