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

Side by Side Diff: src/api.cc

Issue 1369993002: [api] Make sure InterceptorInfo is always in a verifyable state. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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 | « 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 "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 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after
1363 Enumerator enumerator, 1363 Enumerator enumerator,
1364 Local<Value> data, 1364 Local<Value> data,
1365 PropertyHandlerFlags flags) { 1365 PropertyHandlerFlags flags) {
1366 i::Isolate* isolate = Utils::OpenHandle(templ)->GetIsolate(); 1366 i::Isolate* isolate = Utils::OpenHandle(templ)->GetIsolate();
1367 ENTER_V8(isolate); 1367 ENTER_V8(isolate);
1368 i::HandleScope scope(isolate); 1368 i::HandleScope scope(isolate);
1369 auto cons = EnsureConstructor(isolate, templ); 1369 auto cons = EnsureConstructor(isolate, templ);
1370 EnsureNotInstantiated(cons, "ObjectTemplateSetNamedPropertyHandler"); 1370 EnsureNotInstantiated(cons, "ObjectTemplateSetNamedPropertyHandler");
1371 auto obj = i::Handle<i::InterceptorInfo>::cast( 1371 auto obj = i::Handle<i::InterceptorInfo>::cast(
1372 isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE)); 1372 isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE));
1373 obj->set_flags(0);
1373 1374
1374 if (getter != 0) SET_FIELD_WRAPPED(obj, set_getter, getter); 1375 if (getter != 0) SET_FIELD_WRAPPED(obj, set_getter, getter);
1375 if (setter != 0) SET_FIELD_WRAPPED(obj, set_setter, setter); 1376 if (setter != 0) SET_FIELD_WRAPPED(obj, set_setter, setter);
1376 if (query != 0) SET_FIELD_WRAPPED(obj, set_query, query); 1377 if (query != 0) SET_FIELD_WRAPPED(obj, set_query, query);
1377 if (remover != 0) SET_FIELD_WRAPPED(obj, set_deleter, remover); 1378 if (remover != 0) SET_FIELD_WRAPPED(obj, set_deleter, remover);
1378 if (enumerator != 0) SET_FIELD_WRAPPED(obj, set_enumerator, enumerator); 1379 if (enumerator != 0) SET_FIELD_WRAPPED(obj, set_enumerator, enumerator);
1379 obj->set_flags(0);
1380 obj->set_can_intercept_symbols( 1380 obj->set_can_intercept_symbols(
1381 !(static_cast<int>(flags) & 1381 !(static_cast<int>(flags) &
1382 static_cast<int>(PropertyHandlerFlags::kOnlyInterceptStrings))); 1382 static_cast<int>(PropertyHandlerFlags::kOnlyInterceptStrings)));
1383 obj->set_all_can_read(static_cast<int>(flags) & 1383 obj->set_all_can_read(static_cast<int>(flags) &
1384 static_cast<int>(PropertyHandlerFlags::kAllCanRead)); 1384 static_cast<int>(PropertyHandlerFlags::kAllCanRead));
1385 obj->set_non_masking(static_cast<int>(flags) & 1385 obj->set_non_masking(static_cast<int>(flags) &
1386 static_cast<int>(PropertyHandlerFlags::kNonMasking)); 1386 static_cast<int>(PropertyHandlerFlags::kNonMasking));
1387 1387
1388 if (data.IsEmpty()) { 1388 if (data.IsEmpty()) {
1389 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); 1389 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1450 1450
1451 void ObjectTemplate::SetHandler( 1451 void ObjectTemplate::SetHandler(
1452 const IndexedPropertyHandlerConfiguration& config) { 1452 const IndexedPropertyHandlerConfiguration& config) {
1453 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 1453 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
1454 ENTER_V8(isolate); 1454 ENTER_V8(isolate);
1455 i::HandleScope scope(isolate); 1455 i::HandleScope scope(isolate);
1456 auto cons = EnsureConstructor(isolate, this); 1456 auto cons = EnsureConstructor(isolate, this);
1457 EnsureNotInstantiated(cons, "v8::ObjectTemplate::SetHandler"); 1457 EnsureNotInstantiated(cons, "v8::ObjectTemplate::SetHandler");
1458 auto obj = i::Handle<i::InterceptorInfo>::cast( 1458 auto obj = i::Handle<i::InterceptorInfo>::cast(
1459 isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE)); 1459 isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE));
1460 obj->set_flags(0);
1460 1461
1461 if (config.getter != 0) SET_FIELD_WRAPPED(obj, set_getter, config.getter); 1462 if (config.getter != 0) SET_FIELD_WRAPPED(obj, set_getter, config.getter);
1462 if (config.setter != 0) SET_FIELD_WRAPPED(obj, set_setter, config.setter); 1463 if (config.setter != 0) SET_FIELD_WRAPPED(obj, set_setter, config.setter);
1463 if (config.query != 0) SET_FIELD_WRAPPED(obj, set_query, config.query); 1464 if (config.query != 0) SET_FIELD_WRAPPED(obj, set_query, config.query);
1464 if (config.deleter != 0) SET_FIELD_WRAPPED(obj, set_deleter, config.deleter); 1465 if (config.deleter != 0) SET_FIELD_WRAPPED(obj, set_deleter, config.deleter);
1465 if (config.enumerator != 0) { 1466 if (config.enumerator != 0) {
1466 SET_FIELD_WRAPPED(obj, set_enumerator, config.enumerator); 1467 SET_FIELD_WRAPPED(obj, set_enumerator, config.enumerator);
1467 } 1468 }
1468 obj->set_flags(0);
1469 obj->set_all_can_read(static_cast<int>(config.flags) & 1469 obj->set_all_can_read(static_cast<int>(config.flags) &
1470 static_cast<int>(PropertyHandlerFlags::kAllCanRead)); 1470 static_cast<int>(PropertyHandlerFlags::kAllCanRead));
1471 1471
1472 v8::Local<v8::Value> data = config.data; 1472 v8::Local<v8::Value> data = config.data;
1473 if (data.IsEmpty()) { 1473 if (data.IsEmpty()) {
1474 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); 1474 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
1475 } 1475 }
1476 obj->set_data(*Utils::OpenHandle(*data)); 1476 obj->set_data(*Utils::OpenHandle(*data));
1477 cons->set_indexed_property_handler(*obj); 1477 cons->set_indexed_property_handler(*obj);
1478 } 1478 }
(...skipping 6881 matching lines...) Expand 10 before | Expand all | Expand 10 after
8360 Address callback_address = 8360 Address callback_address =
8361 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8361 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8362 VMState<EXTERNAL> state(isolate); 8362 VMState<EXTERNAL> state(isolate);
8363 ExternalCallbackScope call_scope(isolate, callback_address); 8363 ExternalCallbackScope call_scope(isolate, callback_address);
8364 callback(info); 8364 callback(info);
8365 } 8365 }
8366 8366
8367 8367
8368 } // namespace internal 8368 } // namespace internal
8369 } // namespace v8 8369 } // namespace v8
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