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.cc

Issue 334243003: Simplify {Enable|Disable}AccessCheck (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 <stdlib.h> 5 #include <stdlib.h>
6 #include <limits> 6 #include <limits>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 2156 matching lines...) Expand 10 before | Expand all | Expand 10 after
2167 RUNTIME_FUNCTION(Runtime_DisableAccessChecks) { 2167 RUNTIME_FUNCTION(Runtime_DisableAccessChecks) {
2168 HandleScope scope(isolate); 2168 HandleScope scope(isolate);
2169 ASSERT(args.length() == 1); 2169 ASSERT(args.length() == 1);
2170 CONVERT_ARG_HANDLE_CHECKED(HeapObject, object, 0); 2170 CONVERT_ARG_HANDLE_CHECKED(HeapObject, object, 0);
2171 Handle<Map> old_map(object->map()); 2171 Handle<Map> old_map(object->map());
2172 bool needs_access_checks = old_map->is_access_check_needed(); 2172 bool needs_access_checks = old_map->is_access_check_needed();
2173 if (needs_access_checks) { 2173 if (needs_access_checks) {
2174 // Copy map so it won't interfere constructor's initial map. 2174 // Copy map so it won't interfere constructor's initial map.
2175 Handle<Map> new_map = Map::Copy(old_map); 2175 Handle<Map> new_map = Map::Copy(old_map);
2176 new_map->set_is_access_check_needed(false); 2176 new_map->set_is_access_check_needed(false);
2177 if (object->IsJSObject()) { 2177 JSObject::MigrateToMap(Handle<JSObject>::cast(object), new_map);
2178 JSObject::MigrateToMap(Handle<JSObject>::cast(object), new_map);
2179 } else {
2180 object->set_map(*new_map);
2181 }
2182 } 2178 }
2183 return isolate->heap()->ToBoolean(needs_access_checks); 2179 return isolate->heap()->ToBoolean(needs_access_checks);
2184 } 2180 }
2185 2181
2186 2182
2187 RUNTIME_FUNCTION(Runtime_EnableAccessChecks) { 2183 RUNTIME_FUNCTION(Runtime_EnableAccessChecks) {
2188 HandleScope scope(isolate); 2184 HandleScope scope(isolate);
2189 ASSERT(args.length() == 1); 2185 ASSERT(args.length() == 1);
2190 CONVERT_ARG_HANDLE_CHECKED(HeapObject, object, 0); 2186 CONVERT_ARG_HANDLE_CHECKED(HeapObject, object, 0);
2191 Handle<Map> old_map(object->map()); 2187 Handle<Map> old_map(object->map());
2192 if (!old_map->is_access_check_needed()) { 2188 ASSERT(!old_map->is_access_check_needed());
2193 // Copy map so it won't interfere constructor's initial map. 2189 // Copy map so it won't interfere constructor's initial map.
2194 Handle<Map> new_map = Map::Copy(old_map); 2190 Handle<Map> new_map = Map::Copy(old_map);
2195 new_map->set_is_access_check_needed(true); 2191 new_map->set_is_access_check_needed(true);
2196 if (object->IsJSObject()) { 2192 JSObject::MigrateToMap(Handle<JSObject>::cast(object), new_map);
2197 JSObject::MigrateToMap(Handle<JSObject>::cast(object), new_map);
2198 } else {
2199 object->set_map(*new_map);
2200 }
2201 }
2202 return isolate->heap()->undefined_value(); 2193 return isolate->heap()->undefined_value();
2203 } 2194 }
2204 2195
2205 2196
2206 // Transform getter or setter into something DefineAccessor can handle. 2197 // Transform getter or setter into something DefineAccessor can handle.
2207 static Handle<Object> InstantiateAccessorComponent(Isolate* isolate, 2198 static Handle<Object> InstantiateAccessorComponent(Isolate* isolate,
2208 Handle<Object> component) { 2199 Handle<Object> component) {
2209 if (component->IsUndefined()) return isolate->factory()->null_value(); 2200 if (component->IsUndefined()) return isolate->factory()->null_value();
2210 Handle<FunctionTemplateInfo> info = 2201 Handle<FunctionTemplateInfo> info =
2211 Handle<FunctionTemplateInfo>::cast(component); 2202 Handle<FunctionTemplateInfo>::cast(component);
(...skipping 12999 matching lines...) Expand 10 before | Expand all | Expand 10 after
15211 } 15202 }
15212 return NULL; 15203 return NULL;
15213 } 15204 }
15214 15205
15215 15206
15216 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { 15207 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
15217 return &(kIntrinsicFunctions[static_cast<int>(id)]); 15208 return &(kIntrinsicFunctions[static_cast<int>(id)]);
15218 } 15209 }
15219 15210
15220 } } // namespace v8::internal 15211 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698