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

Side by Side Diff: src/api.cc

Issue 1217893012: Remove deprecated v8::Object::TurnOnAccessCheck() from the V8 API. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Deoptimizer::DeoptimizeGlobalObject() removed Created 5 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 unified diff | Download patch
« no previous file with comments | « include/v8.h ('k') | src/deoptimizer.h » ('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/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after
1419 ENTER_V8(isolate); 1419 ENTER_V8(isolate);
1420 i::HandleScope scope(isolate); 1420 i::HandleScope scope(isolate);
1421 auto cons = EnsureConstructor(isolate, this); 1421 auto cons = EnsureConstructor(isolate, this);
1422 EnsureNotInstantiated(cons, "v8::ObjectTemplate::MarkAsUndetectable"); 1422 EnsureNotInstantiated(cons, "v8::ObjectTemplate::MarkAsUndetectable");
1423 cons->set_undetectable(true); 1423 cons->set_undetectable(true);
1424 } 1424 }
1425 1425
1426 1426
1427 void ObjectTemplate::SetAccessCheckCallbacks( 1427 void ObjectTemplate::SetAccessCheckCallbacks(
1428 NamedSecurityCallback named_callback, 1428 NamedSecurityCallback named_callback,
1429 IndexedSecurityCallback indexed_callback, 1429 IndexedSecurityCallback indexed_callback, Handle<Value> data) {
1430 Handle<Value> data,
1431 bool turned_on_by_default) {
1432 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 1430 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
1433 ENTER_V8(isolate); 1431 ENTER_V8(isolate);
1434 i::HandleScope scope(isolate); 1432 i::HandleScope scope(isolate);
1435 auto cons = EnsureConstructor(isolate, this); 1433 auto cons = EnsureConstructor(isolate, this);
1436 EnsureNotInstantiated(cons, "v8::ObjectTemplate::SetAccessCheckCallbacks"); 1434 EnsureNotInstantiated(cons, "v8::ObjectTemplate::SetAccessCheckCallbacks");
1437 1435
1438 i::Handle<i::Struct> struct_info = 1436 i::Handle<i::Struct> struct_info =
1439 isolate->factory()->NewStruct(i::ACCESS_CHECK_INFO_TYPE); 1437 isolate->factory()->NewStruct(i::ACCESS_CHECK_INFO_TYPE);
1440 i::Handle<i::AccessCheckInfo> info = 1438 i::Handle<i::AccessCheckInfo> info =
1441 i::Handle<i::AccessCheckInfo>::cast(struct_info); 1439 i::Handle<i::AccessCheckInfo>::cast(struct_info);
1442 1440
1443 SET_FIELD_WRAPPED(info, set_named_callback, named_callback); 1441 SET_FIELD_WRAPPED(info, set_named_callback, named_callback);
1444 SET_FIELD_WRAPPED(info, set_indexed_callback, indexed_callback); 1442 SET_FIELD_WRAPPED(info, set_indexed_callback, indexed_callback);
1445 1443
1446 if (data.IsEmpty()) { 1444 if (data.IsEmpty()) {
1447 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); 1445 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
1448 } 1446 }
1449 info->set_data(*Utils::OpenHandle(*data)); 1447 info->set_data(*Utils::OpenHandle(*data));
1450 1448
1451 cons->set_access_check_info(*info); 1449 cons->set_access_check_info(*info);
1452 cons->set_needs_access_check(turned_on_by_default); 1450 cons->set_needs_access_check(true);
1453 } 1451 }
1454 1452
1455 1453
1456 void ObjectTemplate::SetHandler( 1454 void ObjectTemplate::SetHandler(
1457 const IndexedPropertyHandlerConfiguration& config) { 1455 const IndexedPropertyHandlerConfiguration& config) {
1458 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 1456 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
1459 ENTER_V8(isolate); 1457 ENTER_V8(isolate);
1460 i::HandleScope scope(isolate); 1458 i::HandleScope scope(isolate);
1461 auto cons = EnsureConstructor(isolate, this); 1459 auto cons = EnsureConstructor(isolate, this);
1462 EnsureNotInstantiated(cons, "v8::ObjectTemplate::SetHandler"); 1460 EnsureNotInstantiated(cons, "v8::ObjectTemplate::SetHandler");
(...skipping 2792 matching lines...) Expand 10 before | Expand all | Expand 10 after
4255 } 4253 }
4256 4254
4257 4255
4258 Maybe<PropertyAttribute> v8::Object::GetRealNamedPropertyAttributes( 4256 Maybe<PropertyAttribute> v8::Object::GetRealNamedPropertyAttributes(
4259 Handle<String> key) { 4257 Handle<String> key) {
4260 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); 4258 auto context = ContextFromHeapObject(Utils::OpenHandle(this));
4261 return GetRealNamedPropertyAttributes(context, key); 4259 return GetRealNamedPropertyAttributes(context, key);
4262 } 4260 }
4263 4261
4264 4262
4265 // Turns on access checks by copying the map and setting the check flag.
4266 // Because the object gets a new map, existing inline cache caching
4267 // the old map of this object will fail.
4268 void v8::Object::TurnOnAccessCheck() {
4269 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
4270 ENTER_V8(isolate);
4271 i::HandleScope scope(isolate);
4272 i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
4273
4274 // When turning on access checks for a global object deoptimize all functions
4275 // as optimized code does not always handle access checks.
4276 i::Deoptimizer::DeoptimizeGlobalObject(*obj);
4277
4278 i::Handle<i::Map> new_map =
4279 i::Map::Copy(i::Handle<i::Map>(obj->map()), "APITurnOnAccessCheck");
4280 new_map->set_is_access_check_needed(true);
4281 i::JSObject::MigrateToMap(obj, new_map);
4282 }
4283
4284
4285 Local<v8::Object> v8::Object::Clone() { 4263 Local<v8::Object> v8::Object::Clone() {
4286 auto self = Utils::OpenHandle(this); 4264 auto self = Utils::OpenHandle(this);
4287 auto isolate = self->GetIsolate(); 4265 auto isolate = self->GetIsolate();
4288 ENTER_V8(isolate); 4266 ENTER_V8(isolate);
4289 auto result = isolate->factory()->CopyJSObject(self); 4267 auto result = isolate->factory()->CopyJSObject(self);
4290 CHECK(!result.is_null()); 4268 CHECK(!result.is_null());
4291 return Utils::ToLocal(result); 4269 return Utils::ToLocal(result);
4292 } 4270 }
4293 4271
4294 4272
(...skipping 4209 matching lines...) Expand 10 before | Expand all | Expand 10 after
8504 Address callback_address = 8482 Address callback_address =
8505 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8483 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8506 VMState<EXTERNAL> state(isolate); 8484 VMState<EXTERNAL> state(isolate);
8507 ExternalCallbackScope call_scope(isolate, callback_address); 8485 ExternalCallbackScope call_scope(isolate, callback_address);
8508 callback(info); 8486 callback(info);
8509 } 8487 }
8510 8488
8511 8489
8512 } // namespace internal 8490 } // namespace internal
8513 } // namespace v8 8491 } // namespace v8
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/deoptimizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698