| 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 4076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4087 return self->SameValue(*other); | 4087 return self->SameValue(*other); |
| 4088 } | 4088 } |
| 4089 | 4089 |
| 4090 Local<String> Value::TypeOf(v8::Isolate* external_isolate) { | 4090 Local<String> Value::TypeOf(v8::Isolate* external_isolate) { |
| 4091 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(external_isolate); | 4091 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(external_isolate); |
| 4092 ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate); | 4092 ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate); |
| 4093 LOG_API(isolate, Value, TypeOf); | 4093 LOG_API(isolate, Value, TypeOf); |
| 4094 return Utils::ToLocal(i::Object::TypeOf(isolate, Utils::OpenHandle(this))); | 4094 return Utils::ToLocal(i::Object::TypeOf(isolate, Utils::OpenHandle(this))); |
| 4095 } | 4095 } |
| 4096 | 4096 |
| 4097 Maybe<bool> Value::InstanceOf(v8::Local<v8::Context> context, |
| 4098 v8::Local<v8::Object> object) { |
| 4099 PREPARE_FOR_EXECUTION_PRIMITIVE(context, Value, InstanceOf, bool); |
| 4100 auto left = Utils::OpenHandle(this); |
| 4101 auto right = Utils::OpenHandle(*object); |
| 4102 i::Handle<i::Object> result; |
| 4103 has_pending_exception = |
| 4104 !i::Object::InstanceOf(isolate, left, right).ToHandle(&result); |
| 4105 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); |
| 4106 return Just(result->IsTrue(isolate)); |
| 4107 } |
| 4108 |
| 4097 Maybe<bool> v8::Object::Set(v8::Local<v8::Context> context, | 4109 Maybe<bool> v8::Object::Set(v8::Local<v8::Context> context, |
| 4098 v8::Local<Value> key, v8::Local<Value> value) { | 4110 v8::Local<Value> key, v8::Local<Value> value) { |
| 4099 PREPARE_FOR_EXECUTION_PRIMITIVE(context, Object, Set, bool); | 4111 PREPARE_FOR_EXECUTION_PRIMITIVE(context, Object, Set, bool); |
| 4100 auto self = Utils::OpenHandle(this); | 4112 auto self = Utils::OpenHandle(this); |
| 4101 auto key_obj = Utils::OpenHandle(*key); | 4113 auto key_obj = Utils::OpenHandle(*key); |
| 4102 auto value_obj = Utils::OpenHandle(*value); | 4114 auto value_obj = Utils::OpenHandle(*value); |
| 4103 has_pending_exception = | 4115 has_pending_exception = |
| 4104 i::Runtime::SetObjectProperty(isolate, self, key_obj, value_obj, | 4116 i::Runtime::SetObjectProperty(isolate, self, key_obj, value_obj, |
| 4105 i::SLOPPY).is_null(); | 4117 i::SLOPPY).is_null(); |
| 4106 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); | 4118 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); |
| (...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5280 auto self = Utils::OpenHandle(this); | 5292 auto self = Utils::OpenHandle(this); |
| 5281 if (self->IsJSBoundFunction()) { | 5293 if (self->IsJSBoundFunction()) { |
| 5282 auto bound_function = i::Handle<i::JSBoundFunction>::cast(self); | 5294 auto bound_function = i::Handle<i::JSBoundFunction>::cast(self); |
| 5283 auto bound_target_function = i::handle( | 5295 auto bound_target_function = i::handle( |
| 5284 bound_function->bound_target_function(), bound_function->GetIsolate()); | 5296 bound_function->bound_target_function(), bound_function->GetIsolate()); |
| 5285 return Utils::CallableToLocal(bound_target_function); | 5297 return Utils::CallableToLocal(bound_target_function); |
| 5286 } | 5298 } |
| 5287 return v8::Undefined(reinterpret_cast<v8::Isolate*>(self->GetIsolate())); | 5299 return v8::Undefined(reinterpret_cast<v8::Isolate*>(self->GetIsolate())); |
| 5288 } | 5300 } |
| 5289 | 5301 |
| 5290 | |
| 5291 int Name::GetIdentityHash() { | 5302 int Name::GetIdentityHash() { |
| 5292 auto self = Utils::OpenHandle(this); | 5303 auto self = Utils::OpenHandle(this); |
| 5293 return static_cast<int>(self->Hash()); | 5304 return static_cast<int>(self->Hash()); |
| 5294 } | 5305 } |
| 5295 | 5306 |
| 5296 | 5307 |
| 5297 int String::Length() const { | 5308 int String::Length() const { |
| 5298 i::Handle<i::String> str = Utils::OpenHandle(this); | 5309 i::Handle<i::String> str = Utils::OpenHandle(this); |
| 5299 return str->length(); | 5310 return str->length(); |
| 5300 } | 5311 } |
| (...skipping 5016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10317 Address callback_address = | 10328 Address callback_address = |
| 10318 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 10329 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 10319 VMState<EXTERNAL> state(isolate); | 10330 VMState<EXTERNAL> state(isolate); |
| 10320 ExternalCallbackScope call_scope(isolate, callback_address); | 10331 ExternalCallbackScope call_scope(isolate, callback_address); |
| 10321 callback(info); | 10332 callback(info); |
| 10322 } | 10333 } |
| 10323 | 10334 |
| 10324 | 10335 |
| 10325 } // namespace internal | 10336 } // namespace internal |
| 10326 } // namespace v8 | 10337 } // namespace v8 |
| OLD | NEW |