OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/builtins.h" | 5 #include "src/builtins/builtins.h" |
6 #include "src/builtins/builtins-utils.h" | 6 #include "src/builtins/builtins-utils.h" |
7 | 7 |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/uri.h" | 10 #include "src/uri.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 isolate, string, | 76 isolate, string, |
77 Object::ToString(isolate, args.atOrUndefined(isolate, 1))); | 77 Object::ToString(isolate, args.atOrUndefined(isolate, 1))); |
78 | 78 |
79 RETURN_RESULT_OR_FAILURE(isolate, Uri::Unescape(isolate, string)); | 79 RETURN_RESULT_OR_FAILURE(isolate, Uri::Unescape(isolate, string)); |
80 } | 80 } |
81 | 81 |
82 // ES6 section 18.2.1 eval (x) | 82 // ES6 section 18.2.1 eval (x) |
83 BUILTIN(GlobalEval) { | 83 BUILTIN(GlobalEval) { |
84 HandleScope scope(isolate); | 84 HandleScope scope(isolate); |
85 Handle<Object> x = args.atOrUndefined(isolate, 1); | 85 Handle<Object> x = args.atOrUndefined(isolate, 1); |
86 Handle<JSFunction> target = args.target<JSFunction>(); | 86 Handle<JSFunction> target = args.target(); |
87 Handle<JSObject> target_global_proxy(target->global_proxy(), isolate); | 87 Handle<JSObject> target_global_proxy(target->global_proxy(), isolate); |
88 if (!x->IsString()) return *x; | 88 if (!x->IsString()) return *x; |
89 if (!Builtins::AllowDynamicFunction(isolate, target, target_global_proxy)) { | 89 if (!Builtins::AllowDynamicFunction(isolate, target, target_global_proxy)) { |
90 isolate->CountUsage(v8::Isolate::kFunctionConstructorReturnedUndefined); | 90 isolate->CountUsage(v8::Isolate::kFunctionConstructorReturnedUndefined); |
91 return isolate->heap()->undefined_value(); | 91 return isolate->heap()->undefined_value(); |
92 } | 92 } |
93 Handle<JSFunction> function; | 93 Handle<JSFunction> function; |
94 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 94 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
95 isolate, function, Compiler::GetFunctionFromString( | 95 isolate, function, Compiler::GetFunctionFromString( |
96 handle(target->native_context(), isolate), | 96 handle(target->native_context(), isolate), |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 203 |
204 assembler->Bind(&return_true); | 204 assembler->Bind(&return_true); |
205 assembler->Return(assembler->BooleanConstant(true)); | 205 assembler->Return(assembler->BooleanConstant(true)); |
206 | 206 |
207 assembler->Bind(&return_false); | 207 assembler->Bind(&return_false); |
208 assembler->Return(assembler->BooleanConstant(false)); | 208 assembler->Return(assembler->BooleanConstant(false)); |
209 } | 209 } |
210 | 210 |
211 } // namespace internal | 211 } // namespace internal |
212 } // namespace v8 | 212 } // namespace v8 |
OLD | NEW |