| Index: src/api.cc
|
| diff --git a/src/api.cc b/src/api.cc
|
| index 0bb374f2dc69bea8e712d4962363e835bfbb80bc..65e73450239c352381676bedb560b332761ef3cd 100644
|
| --- a/src/api.cc
|
| +++ b/src/api.cc
|
| @@ -568,7 +568,14 @@ ResourceConstraints::ResourceConstraints()
|
|
|
| bool SetResourceConstraints(ResourceConstraints* constraints) {
|
| i::Isolate* isolate = EnterIsolateIfNeeded();
|
| + return SetResourceConstraints(reinterpret_cast<Isolate*>(isolate),
|
| + constraints);
|
| +}
|
| +
|
|
|
| +bool SetResourceConstraints(Isolate* v8_isolate,
|
| + ResourceConstraints* constraints) {
|
| + i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
|
| int young_space_size = constraints->max_young_space_size();
|
| int old_gen_size = constraints->max_old_space_size();
|
| int max_executable_size = constraints->max_executable_size();
|
| @@ -3129,7 +3136,7 @@ bool v8::Object::Set(v8::Handle<Value> key, v8::Handle<Value> value,
|
| i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
|
| i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
|
| EXCEPTION_PREAMBLE(isolate);
|
| - i::Handle<i::Object> obj = i::SetProperty(
|
| + i::Handle<i::Object> obj = i::Runtime::SetObjectProperty(
|
| isolate,
|
| self,
|
| key_obj,
|
| @@ -3184,6 +3191,12 @@ bool v8::Object::ForceSet(v8::Handle<Value> key,
|
| }
|
|
|
|
|
| +bool v8::Object::SetPrivate(v8::Handle<Private> key, v8::Handle<Value> value) {
|
| + return Set(v8::Handle<Value>(reinterpret_cast<Value*>(*key)),
|
| + value, DontEnum);
|
| +}
|
| +
|
| +
|
| bool v8::Object::ForceDelete(v8::Handle<Value> key) {
|
| i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
|
| ON_BAILOUT(isolate, "v8::Object::ForceDelete()", return false);
|
| @@ -3235,6 +3248,11 @@ Local<Value> v8::Object::Get(uint32_t index) {
|
| }
|
|
|
|
|
| +Local<Value> v8::Object::GetPrivate(v8::Handle<Private> key) {
|
| + return Get(v8::Handle<Value>(reinterpret_cast<Value*>(*key)));
|
| +}
|
| +
|
| +
|
| PropertyAttribute v8::Object::GetPropertyAttributes(v8::Handle<Value> key) {
|
| i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
|
| ON_BAILOUT(isolate, "v8::Object::GetPropertyAttribute()",
|
| @@ -3434,6 +3452,11 @@ bool v8::Object::Delete(v8::Handle<Value> key) {
|
| }
|
|
|
|
|
| +bool v8::Object::DeletePrivate(v8::Handle<Private> key) {
|
| + return Delete(v8::Handle<Value>(reinterpret_cast<Value*>(*key)));
|
| +}
|
| +
|
| +
|
| bool v8::Object::Has(v8::Handle<Value> key) {
|
| i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
|
| ON_BAILOUT(isolate, "v8::Object::Has()", return false);
|
| @@ -3448,6 +3471,11 @@ bool v8::Object::Has(v8::Handle<Value> key) {
|
| }
|
|
|
|
|
| +bool v8::Object::HasPrivate(v8::Handle<Private> key) {
|
| + return Has(v8::Handle<Value>(reinterpret_cast<Value*>(*key)));
|
| +}
|
| +
|
| +
|
| bool v8::Object::Delete(uint32_t index) {
|
| i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
|
| ON_BAILOUT(isolate, "v8::Object::DeleteProperty()",
|
| @@ -3688,7 +3716,8 @@ int v8::Object::GetIdentityHash() {
|
| ENTER_V8(isolate);
|
| i::HandleScope scope(isolate);
|
| i::Handle<i::JSObject> self = Utils::OpenHandle(this);
|
| - return i::JSObject::GetIdentityHash(self);
|
| + return i::Handle<i::Smi>::cast(
|
| + i::JSReceiver::GetOrCreateIdentityHash(self))->value();
|
| }
|
|
|
|
|
| @@ -4868,6 +4897,11 @@ Local<Value> Symbol::Name() const {
|
| }
|
|
|
|
|
| +Local<Value> Private::Name() const {
|
| + return reinterpret_cast<const Symbol*>(this)->Name();
|
| +}
|
| +
|
| +
|
| double Number::Value() const {
|
| i::Handle<i::Object> obj = Utils::OpenHandle(this);
|
| return obj->Number();
|
| @@ -5361,17 +5395,22 @@ bool FunctionTemplate::HasInstance(v8::Handle<v8::Value> value) {
|
| }
|
|
|
|
|
| -Local<External> v8::External::New(void* value) {
|
| +Local<External> v8::External::New(Isolate* isolate, void* value) {
|
| STATIC_ASSERT(sizeof(value) == sizeof(i::Address));
|
| - i::Isolate* isolate = i::Isolate::Current();
|
| - EnsureInitializedForIsolate(isolate, "v8::External::New()");
|
| - LOG_API(isolate, "External::New");
|
| - ENTER_V8(isolate);
|
| - i::Handle<i::JSObject> external = isolate->factory()->NewExternal(value);
|
| + i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
| + EnsureInitializedForIsolate(i_isolate, "v8::External::New()");
|
| + LOG_API(i_isolate, "External::New");
|
| + ENTER_V8(i_isolate);
|
| + i::Handle<i::JSObject> external = i_isolate->factory()->NewExternal(value);
|
| return Utils::ExternalToLocal(external);
|
| }
|
|
|
|
|
| +Local<External> v8::External::New(void* value) {
|
| + return v8::External::New(Isolate::GetCurrent(), value);
|
| +}
|
| +
|
| +
|
| void* External::Value() const {
|
| return ExternalValue(*Utils::OpenHandle(this));
|
| }
|
| @@ -6125,27 +6164,37 @@ Local<DataView> DataView::New(Handle<ArrayBuffer> array_buffer,
|
| }
|
|
|
|
|
| -Local<Symbol> v8::Symbol::New(Isolate* isolate) {
|
| +Local<Symbol> v8::Symbol::New(Isolate* isolate, const char* data, int length) {
|
| i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
| EnsureInitializedForIsolate(i_isolate, "v8::Symbol::New()");
|
| LOG_API(i_isolate, "Symbol::New()");
|
| ENTER_V8(i_isolate);
|
| i::Handle<i::Symbol> result = i_isolate->factory()->NewSymbol();
|
| + if (data != NULL) {
|
| + if (length == -1) length = i::StrLength(data);
|
| + i::Handle<i::String> name = i_isolate->factory()->NewStringFromUtf8(
|
| + i::Vector<const char>(data, length));
|
| + result->set_name(*name);
|
| + }
|
| return Utils::ToLocal(result);
|
| }
|
|
|
|
|
| -Local<Symbol> v8::Symbol::New(Isolate* isolate, const char* data, int length) {
|
| +Local<Private> v8::Private::New(
|
| + Isolate* isolate, const char* data, int length) {
|
| i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
| - EnsureInitializedForIsolate(i_isolate, "v8::Symbol::New()");
|
| - LOG_API(i_isolate, "Symbol::New(char)");
|
| + EnsureInitializedForIsolate(i_isolate, "v8::Private::New()");
|
| + LOG_API(i_isolate, "Private::New()");
|
| ENTER_V8(i_isolate);
|
| - if (length == -1) length = i::StrLength(data);
|
| - i::Handle<i::String> name = i_isolate->factory()->NewStringFromUtf8(
|
| - i::Vector<const char>(data, length));
|
| - i::Handle<i::Symbol> result = i_isolate->factory()->NewSymbol();
|
| - result->set_name(*name);
|
| - return Utils::ToLocal(result);
|
| + i::Handle<i::Symbol> symbol = i_isolate->factory()->NewPrivateSymbol();
|
| + if (data != NULL) {
|
| + if (length == -1) length = i::StrLength(data);
|
| + i::Handle<i::String> name = i_isolate->factory()->NewStringFromUtf8(
|
| + i::Vector<const char>(data, length));
|
| + symbol->set_name(*name);
|
| + }
|
| + Local<Symbol> result = Utils::ToLocal(symbol);
|
| + return v8::Handle<Private>(reinterpret_cast<Private*>(*result));
|
| }
|
|
|
|
|
|
|