OLD | NEW |
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/builtins.h" | 5 #include "src/builtins/builtins.h" |
6 #include "src/code-events.h" | 6 #include "src/code-events.h" |
7 #include "src/code-stub-assembler.h" | 7 #include "src/code-stub-assembler.h" |
8 #include "src/ic/ic-state.h" | 8 #include "src/ic/ic-state.h" |
9 #include "src/interface-descriptors.h" | 9 #include "src/interface-descriptors.h" |
10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 } | 199 } |
200 | 200 |
201 #define DEFINE_BUILTIN_ACCESSOR(Name, ...) \ | 201 #define DEFINE_BUILTIN_ACCESSOR(Name, ...) \ |
202 Handle<Code> Builtins::Name() { \ | 202 Handle<Code> Builtins::Name() { \ |
203 Code** code_address = reinterpret_cast<Code**>(builtin_address(k##Name)); \ | 203 Code** code_address = reinterpret_cast<Code**>(builtin_address(k##Name)); \ |
204 return Handle<Code>(code_address); \ | 204 return Handle<Code>(code_address); \ |
205 } | 205 } |
206 BUILTIN_LIST_ALL(DEFINE_BUILTIN_ACCESSOR) | 206 BUILTIN_LIST_ALL(DEFINE_BUILTIN_ACCESSOR) |
207 #undef DEFINE_BUILTIN_ACCESSOR | 207 #undef DEFINE_BUILTIN_ACCESSOR |
208 | 208 |
| 209 // static |
| 210 bool Builtins::AllowDynamicFunction(Isolate* isolate, Handle<JSFunction> target, |
| 211 Handle<JSObject> target_global_proxy) { |
| 212 if (FLAG_allow_unsafe_function_constructor) return true; |
| 213 HandleScopeImplementer* impl = isolate->handle_scope_implementer(); |
| 214 Handle<Context> responsible_context = impl->LastEnteredContext(); |
| 215 if (responsible_context.is_null()) { |
| 216 responsible_context = impl->MicrotaskContext(); |
| 217 // TODO(jochen): Remove this. |
| 218 if (responsible_context.is_null()) { |
| 219 return true; |
| 220 } |
| 221 } |
| 222 if (*responsible_context == target->context()) return true; |
| 223 return isolate->MayAccess(responsible_context, target_global_proxy); |
| 224 } |
| 225 |
209 } // namespace internal | 226 } // namespace internal |
210 } // namespace v8 | 227 } // namespace v8 |
OLD | NEW |