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

Side by Side Diff: src/builtins/builtins.cc

Issue 2199343002: Do an access check before compiling code via eval() (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 4 years, 4 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/builtins/builtins.h ('k') | src/builtins/builtins-function.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 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
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
OLDNEW
« 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