| 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/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 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1450 if (getter != 0) SET_FIELD_WRAPPED(obj, set_getter, getter); | 1450 if (getter != 0) SET_FIELD_WRAPPED(obj, set_getter, getter); |
| 1451 if (setter != 0) SET_FIELD_WRAPPED(obj, set_setter, setter); | 1451 if (setter != 0) SET_FIELD_WRAPPED(obj, set_setter, setter); |
| 1452 if (query != 0) SET_FIELD_WRAPPED(obj, set_query, query); | 1452 if (query != 0) SET_FIELD_WRAPPED(obj, set_query, query); |
| 1453 if (remover != 0) SET_FIELD_WRAPPED(obj, set_deleter, remover); | 1453 if (remover != 0) SET_FIELD_WRAPPED(obj, set_deleter, remover); |
| 1454 if (enumerator != 0) SET_FIELD_WRAPPED(obj, set_enumerator, enumerator); | 1454 if (enumerator != 0) SET_FIELD_WRAPPED(obj, set_enumerator, enumerator); |
| 1455 | 1455 |
| 1456 if (data.IsEmpty()) { | 1456 if (data.IsEmpty()) { |
| 1457 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); | 1457 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |
| 1458 } | 1458 } |
| 1459 obj->set_data(*Utils::OpenHandle(*data)); | 1459 obj->set_data(*Utils::OpenHandle(*data)); |
| 1460 obj->set_flag(i::Smi::FromInt(0)); |
| 1460 cons->set_named_property_handler(*obj); | 1461 cons->set_named_property_handler(*obj); |
| 1461 } | 1462 } |
| 1462 | 1463 |
| 1463 | 1464 |
| 1464 void ObjectTemplate::MarkAsUndetectable() { | 1465 void ObjectTemplate::MarkAsUndetectable() { |
| 1465 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 1466 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 1466 ENTER_V8(isolate); | 1467 ENTER_V8(isolate); |
| 1467 i::HandleScope scope(isolate); | 1468 i::HandleScope scope(isolate); |
| 1468 EnsureConstructor(isolate, this); | 1469 EnsureConstructor(isolate, this); |
| 1469 i::FunctionTemplateInfo* constructor = | 1470 i::FunctionTemplateInfo* constructor = |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1526 if (getter != 0) SET_FIELD_WRAPPED(obj, set_getter, getter); | 1527 if (getter != 0) SET_FIELD_WRAPPED(obj, set_getter, getter); |
| 1527 if (setter != 0) SET_FIELD_WRAPPED(obj, set_setter, setter); | 1528 if (setter != 0) SET_FIELD_WRAPPED(obj, set_setter, setter); |
| 1528 if (query != 0) SET_FIELD_WRAPPED(obj, set_query, query); | 1529 if (query != 0) SET_FIELD_WRAPPED(obj, set_query, query); |
| 1529 if (remover != 0) SET_FIELD_WRAPPED(obj, set_deleter, remover); | 1530 if (remover != 0) SET_FIELD_WRAPPED(obj, set_deleter, remover); |
| 1530 if (enumerator != 0) SET_FIELD_WRAPPED(obj, set_enumerator, enumerator); | 1531 if (enumerator != 0) SET_FIELD_WRAPPED(obj, set_enumerator, enumerator); |
| 1531 | 1532 |
| 1532 if (data.IsEmpty()) { | 1533 if (data.IsEmpty()) { |
| 1533 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); | 1534 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |
| 1534 } | 1535 } |
| 1535 obj->set_data(*Utils::OpenHandle(*data)); | 1536 obj->set_data(*Utils::OpenHandle(*data)); |
| 1537 obj->set_flag(i::Smi::FromInt(0)); |
| 1536 cons->set_indexed_property_handler(*obj); | 1538 cons->set_indexed_property_handler(*obj); |
| 1537 } | 1539 } |
| 1538 | 1540 |
| 1539 | 1541 |
| 1540 void ObjectTemplate::SetCallAsFunctionHandler(FunctionCallback callback, | 1542 void ObjectTemplate::SetCallAsFunctionHandler(FunctionCallback callback, |
| 1541 Handle<Value> data) { | 1543 Handle<Value> data) { |
| 1542 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 1544 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 1543 ENTER_V8(isolate); | 1545 ENTER_V8(isolate); |
| 1544 i::HandleScope scope(isolate); | 1546 i::HandleScope scope(isolate); |
| 1545 EnsureConstructor(isolate, this); | 1547 EnsureConstructor(isolate, this); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1575 if (value > 0) { | 1577 if (value > 0) { |
| 1576 // The internal field count is set by the constructor function's | 1578 // The internal field count is set by the constructor function's |
| 1577 // construct code, so we ensure that there is a constructor | 1579 // construct code, so we ensure that there is a constructor |
| 1578 // function to do the setting. | 1580 // function to do the setting. |
| 1579 EnsureConstructor(isolate, this); | 1581 EnsureConstructor(isolate, this); |
| 1580 } | 1582 } |
| 1581 Utils::OpenHandle(this)->set_internal_field_count(i::Smi::FromInt(value)); | 1583 Utils::OpenHandle(this)->set_internal_field_count(i::Smi::FromInt(value)); |
| 1582 } | 1584 } |
| 1583 | 1585 |
| 1584 | 1586 |
| 1587 void ObjectTemplate::UninterceptorRealName(bool unset) { |
| 1588 i::Object* obj = Utils::OpenHandle(this)->constructor(); |
| 1589 if (!obj->IsUndefined()) { |
| 1590 i::FunctionTemplateInfo* info = i::FunctionTemplateInfo::cast(obj); |
| 1591 i::InterceptorInfo* interceptor = |
| 1592 i::InterceptorInfo::cast(info->named_property_handler()); |
| 1593 if (!interceptor->IsUndefined()) |
| 1594 interceptor->set_do_not_interceptor_real_name(unset); |
| 1595 } |
| 1596 } |
| 1597 |
| 1598 |
| 1585 // --- S c r i p t s --- | 1599 // --- S c r i p t s --- |
| 1586 | 1600 |
| 1587 | 1601 |
| 1588 // Internally, UnboundScript is a SharedFunctionInfo, and Script is a | 1602 // Internally, UnboundScript is a SharedFunctionInfo, and Script is a |
| 1589 // JSFunction. | 1603 // JSFunction. |
| 1590 | 1604 |
| 1591 ScriptCompiler::CachedData::CachedData(const uint8_t* data_, int length_, | 1605 ScriptCompiler::CachedData::CachedData(const uint8_t* data_, int length_, |
| 1592 BufferPolicy buffer_policy_) | 1606 BufferPolicy buffer_policy_) |
| 1593 : data(data_), length(length_), buffer_policy(buffer_policy_) {} | 1607 : data(data_), length(length_), buffer_policy(buffer_policy_) {} |
| 1594 | 1608 |
| (...skipping 6025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7620 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7634 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7621 Address callback_address = | 7635 Address callback_address = |
| 7622 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7636 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7623 VMState<EXTERNAL> state(isolate); | 7637 VMState<EXTERNAL> state(isolate); |
| 7624 ExternalCallbackScope call_scope(isolate, callback_address); | 7638 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7625 callback(info); | 7639 callback(info); |
| 7626 } | 7640 } |
| 7627 | 7641 |
| 7628 | 7642 |
| 7629 } } // namespace v8::internal | 7643 } } // namespace v8::internal |
| OLD | NEW |