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

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

Issue 2060213002: Revert of Replace all remaining Oddball checks with new function (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « src/runtime/runtime-classes.cc ('k') | src/runtime/runtime-debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 } 296 }
297 297
298 isolate->optimizing_compile_dispatcher()->InstallOptimizedFunctions(); 298 isolate->optimizing_compile_dispatcher()->InstallOptimizedFunctions();
299 return (function->IsOptimized()) ? function->code() 299 return (function->IsOptimized()) ? function->code()
300 : function->shared()->code(); 300 : function->shared()->code();
301 } 301 }
302 302
303 303
304 bool CodeGenerationFromStringsAllowed(Isolate* isolate, 304 bool CodeGenerationFromStringsAllowed(Isolate* isolate,
305 Handle<Context> context) { 305 Handle<Context> context) {
306 DCHECK(context->allow_code_gen_from_strings()->IsFalse(isolate)); 306 DCHECK(context->allow_code_gen_from_strings()->IsFalse());
307 // Check with callback if set. 307 // Check with callback if set.
308 AllowCodeGenerationFromStringsCallback callback = 308 AllowCodeGenerationFromStringsCallback callback =
309 isolate->allow_code_gen_callback(); 309 isolate->allow_code_gen_callback();
310 if (callback == NULL) { 310 if (callback == NULL) {
311 // No callback set and code generation disallowed. 311 // No callback set and code generation disallowed.
312 return false; 312 return false;
313 } else { 313 } else {
314 // Callback set. Let it decide if code generation is allowed. 314 // Callback set. Let it decide if code generation is allowed.
315 VMState<EXTERNAL> state(isolate); 315 VMState<EXTERNAL> state(isolate);
316 return callback(v8::Utils::ToLocal(context)); 316 return callback(v8::Utils::ToLocal(context));
317 } 317 }
318 } 318 }
319 319
320 static Object* CompileGlobalEval(Isolate* isolate, Handle<String> source, 320 static Object* CompileGlobalEval(Isolate* isolate, Handle<String> source,
321 Handle<SharedFunctionInfo> outer_info, 321 Handle<SharedFunctionInfo> outer_info,
322 LanguageMode language_mode, 322 LanguageMode language_mode,
323 int eval_scope_position, int eval_position) { 323 int eval_scope_position, int eval_position) {
324 Handle<Context> context = Handle<Context>(isolate->context()); 324 Handle<Context> context = Handle<Context>(isolate->context());
325 Handle<Context> native_context = Handle<Context>(context->native_context()); 325 Handle<Context> native_context = Handle<Context>(context->native_context());
326 326
327 // Check if native context allows code generation from 327 // Check if native context allows code generation from
328 // strings. Throw an exception if it doesn't. 328 // strings. Throw an exception if it doesn't.
329 if (native_context->allow_code_gen_from_strings()->IsFalse(isolate) && 329 if (native_context->allow_code_gen_from_strings()->IsFalse() &&
330 !CodeGenerationFromStringsAllowed(isolate, native_context)) { 330 !CodeGenerationFromStringsAllowed(isolate, native_context)) {
331 Handle<Object> error_message = 331 Handle<Object> error_message =
332 native_context->ErrorMessageForCodeGenerationFromStrings(); 332 native_context->ErrorMessageForCodeGenerationFromStrings();
333 Handle<Object> error; 333 Handle<Object> error;
334 MaybeHandle<Object> maybe_error = isolate->factory()->NewEvalError( 334 MaybeHandle<Object> maybe_error = isolate->factory()->NewEvalError(
335 MessageTemplate::kCodeGenFromStrings, error_message); 335 MessageTemplate::kCodeGenFromStrings, error_message);
336 if (maybe_error.ToHandle(&error)) isolate->Throw(*error); 336 if (maybe_error.ToHandle(&error)) isolate->Throw(*error);
337 return isolate->heap()->exception(); 337 return isolate->heap()->exception();
338 } 338 }
339 339
(...skipping 30 matching lines...) Expand all
370 DCHECK(is_valid_language_mode(args.smi_at(3))); 370 DCHECK(is_valid_language_mode(args.smi_at(3)));
371 LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(3)); 371 LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(3));
372 DCHECK(args[4]->IsSmi()); 372 DCHECK(args[4]->IsSmi());
373 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), 373 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(),
374 isolate); 374 isolate);
375 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, 375 return CompileGlobalEval(isolate, args.at<String>(1), outer_info,
376 language_mode, args.smi_at(4), args.smi_at(5)); 376 language_mode, args.smi_at(4), args.smi_at(5));
377 } 377 }
378 } // namespace internal 378 } // namespace internal
379 } // namespace v8 379 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime-classes.cc ('k') | src/runtime/runtime-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698