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

Unified Diff: src/builtins/builtins.cc

Issue 2163933002: Move CompileString to Compiler (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comments Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/builtins/builtins.h ('k') | src/builtins/builtins-function.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/builtins.cc
diff --git a/src/builtins/builtins.cc b/src/builtins/builtins.cc
index f8af743e0bc2ff0a33eb5a5a6542bfa9e22f7c26..376be283015e13ea7f9b8c9d01fcba18fd3a416a 100644
--- a/src/builtins/builtins.cc
+++ b/src/builtins/builtins.cc
@@ -271,52 +271,6 @@ BUILTIN(HandleApiCall) {
}
}
-namespace {
-
-bool CodeGenerationFromStringsAllowed(Isolate* isolate,
- Handle<Context> context) {
- DCHECK(context->allow_code_gen_from_strings()->IsFalse(isolate));
- // Check with callback if set.
- AllowCodeGenerationFromStringsCallback callback =
- isolate->allow_code_gen_callback();
- if (callback == NULL) {
- // No callback set and code generation disallowed.
- return false;
- } else {
- // Callback set. Let it decide if code generation is allowed.
- VMState<EXTERNAL> state(isolate);
- return callback(v8::Utils::ToLocal(context));
- }
-}
-
-} // namespace
-
-MaybeHandle<JSFunction> Builtins::CompileString(Handle<Context> context,
- Handle<String> source,
- ParseRestriction restriction) {
- Isolate* const isolate = context->GetIsolate();
- Handle<Context> native_context(context->native_context(), isolate);
-
- // Check if native context allows code generation from
- // strings. Throw an exception if it doesn't.
- if (native_context->allow_code_gen_from_strings()->IsFalse(isolate) &&
- !CodeGenerationFromStringsAllowed(isolate, native_context)) {
- Handle<Object> error_message =
- native_context->ErrorMessageForCodeGenerationFromStrings();
- THROW_NEW_ERROR(isolate, NewEvalError(MessageTemplate::kCodeGenFromStrings,
- error_message),
- JSFunction);
- }
-
- // Compile source string in the native context.
- int eval_scope_position = 0;
- int eval_position = kNoSourcePosition;
- Handle<SharedFunctionInfo> outer_info(native_context->closure()->shared());
- return Compiler::GetFunctionFromEval(source, outer_info, native_context,
- SLOPPY, restriction, eval_scope_position,
- eval_position);
-}
-
Handle<Code> Builtins::CallFunction(ConvertReceiverMode mode,
TailCallMode tail_call_mode) {
switch (tail_call_mode) {
« no previous file with comments | « src/builtins/builtins.h ('k') | src/builtins/builtins-function.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698