Map v8::Object to v8::internal::JSReceiver

BUG=none
R=verwaest@chromium.org,rossberg@chromium.org,bmeurer@chromium.org,neis@chromium.org
LOG=y

Review URL: https://codereview.chromium.org/1413463006

Cr-Commit-Position: refs/heads/master@{#32014}
This commit is contained in:
jochen 2015-11-16 08:48:43 -08:00 committed by Commit bot
parent a0253e8594
commit 6ce7f90aba
12 changed files with 214 additions and 151 deletions

View File

@ -161,7 +161,8 @@ void Accessors::ArgumentsIteratorSetter(
const v8::PropertyCallbackInfo<void>& info) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
HandleScope scope(isolate);
Handle<JSObject> object_handle = Utils::OpenHandle(*info.This());
Handle<JSObject> object_handle =
Handle<JSObject>::cast(Utils::OpenHandle(*info.This()));
Handle<Object> value_handle = Utils::OpenHandle(*val);
Handle<Name> name_handle = Utils::OpenHandle(*name);
@ -205,7 +206,7 @@ void Accessors::ArrayLengthSetter(
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
HandleScope scope(isolate);
Handle<JSObject> object = Utils::OpenHandle(*info.This());
Handle<JSReceiver> object = Utils::OpenHandle(*info.This());
Handle<JSArray> array = Handle<JSArray>::cast(object);
Handle<Object> length_obj = Utils::OpenHandle(*val);

View File

@ -1956,8 +1956,9 @@ MaybeLocal<Function> ScriptCompiler::CompileFunctionInContext(
i::Handle<i::SharedFunctionInfo> outer_info(context->closure()->shared(),
isolate);
for (size_t i = 0; i < context_extension_count; ++i) {
i::Handle<i::JSObject> extension =
i::Handle<i::JSReceiver> extension =
Utils::OpenHandle(*context_extensions[i]);
if (!extension->IsJSObject()) return Local<Function>();
i::Handle<i::JSFunction> closure(context->closure(), isolate);
context = factory->NewWithContext(closure, context, extension);
}
@ -3041,8 +3042,7 @@ void External::CheckCast(v8::Value* that) {
void v8::Object::CheckCast(Value* that) {
i::Handle<i::Object> obj = Utils::OpenHandle(that);
Utils::ApiCheck(obj->IsJSObject(),
"v8::Object::Cast()",
Utils::ApiCheck(obj->IsJSReceiver(), "v8::Object::Cast()",
"Could not convert to object");
}
@ -3480,13 +3480,13 @@ Maybe<bool> v8::Object::CreateDataProperty(v8::Local<v8::Context> context,
v8::Local<Value> value) {
PREPARE_FOR_EXECUTION_PRIMITIVE(context, "v8::Object::CreateDataProperty()",
bool);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::JSReceiver> self = Utils::OpenHandle(this);
i::Handle<i::Name> key_obj = Utils::OpenHandle(*key);
i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
i::LookupIterator it = i::LookupIterator::PropertyOrElement(
isolate, self, key_obj, i::LookupIterator::OWN);
Maybe<bool> result = i::JSObject::CreateDataProperty(&it, value_obj);
Maybe<bool> result = i::JSReceiver::CreateDataProperty(&it, value_obj);
has_pending_exception = result.IsNothing();
RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
return result;
@ -3498,11 +3498,11 @@ Maybe<bool> v8::Object::CreateDataProperty(v8::Local<v8::Context> context,
v8::Local<Value> value) {
PREPARE_FOR_EXECUTION_PRIMITIVE(context, "v8::Object::CreateDataProperty()",
bool);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::JSReceiver> self = Utils::OpenHandle(this);
i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
i::LookupIterator it(isolate, self, index, i::LookupIterator::OWN);
Maybe<bool> result = i::JSObject::CreateDataProperty(&it, value_obj);
Maybe<bool> result = i::JSReceiver::CreateDataProperty(&it, value_obj);
has_pending_exception = result.IsNothing();
RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
return result;
@ -3515,13 +3515,14 @@ Maybe<bool> v8::Object::DefineOwnProperty(v8::Local<v8::Context> context,
v8::PropertyAttribute attributes) {
PREPARE_FOR_EXECUTION_PRIMITIVE(context, "v8::Object::DefineOwnProperty()",
bool);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::JSReceiver> self = Utils::OpenHandle(this);
i::Handle<i::Name> key_obj = Utils::OpenHandle(*key);
i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
if (self->IsAccessCheckNeeded() &&
!isolate->MayAccess(handle(isolate->context()), self)) {
isolate->ReportFailedAccessCheck(self);
!isolate->MayAccess(handle(isolate->context()),
i::Handle<i::JSObject>::cast(self))) {
isolate->ReportFailedAccessCheck(i::Handle<i::JSObject>::cast(self));
return Nothing<bool>();
}
@ -3555,8 +3556,8 @@ static i::MaybeHandle<i::Object> DefineObjectProperty(
Maybe<bool> v8::Object::ForceSet(v8::Local<v8::Context> context,
v8::Local<Value> key, v8::Local<Value> value,
v8::PropertyAttribute attribs) {
PREPARE_FOR_EXECUTION_PRIMITIVE(context, "v8::Object::Set()", bool);
auto self = Utils::OpenHandle(this);
PREPARE_FOR_EXECUTION_PRIMITIVE(context, "v8::Object::ForceSet()", bool);
auto self = i::Handle<i::JSObject>::cast(Utils::OpenHandle(this));
auto key_obj = Utils::OpenHandle(*key);
auto value_obj = Utils::OpenHandle(*value);
has_pending_exception =
@ -3573,7 +3574,8 @@ bool v8::Object::ForceSet(v8::Local<Value> key, v8::Local<Value> value,
PREPARE_FOR_EXECUTION_GENERIC(isolate, Local<Context>(),
"v8::Object::ForceSet", false, i::HandleScope,
false);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::JSObject> self =
i::Handle<i::JSObject>::cast(Utils::OpenHandle(this));
i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
has_pending_exception =
@ -3702,8 +3704,8 @@ Maybe<bool> v8::Object::SetPrototype(Local<Context> context,
// We do not allow exceptions thrown while setting the prototype
// to propagate outside.
TryCatch try_catch(reinterpret_cast<v8::Isolate*>(isolate));
auto result = i::JSObject::SetPrototype(self, value_obj, false,
i::Object::THROW_ON_ERROR);
auto result = i::JSReceiver::SetPrototype(self, value_obj, false,
i::Object::THROW_ON_ERROR);
has_pending_exception = result.IsNothing();
RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
return Just(true);
@ -3944,24 +3946,27 @@ bool v8::Object::Has(uint32_t index) {
template <typename Getter, typename Setter, typename Data>
static Maybe<bool> ObjectSetAccessor(Local<Context> context, Object* obj,
static Maybe<bool> ObjectSetAccessor(Local<Context> context, Object* self,
Local<Name> name, Getter getter,
Setter setter, Data data,
AccessControl settings,
PropertyAttribute attributes) {
PREPARE_FOR_EXECUTION_PRIMITIVE(context, "v8::Object::SetAccessor()", bool);
if (!Utils::OpenHandle(self)->IsJSObject()) return Just(false);
i::Handle<i::JSObject> obj =
i::Handle<i::JSObject>::cast(Utils::OpenHandle(self));
v8::Local<AccessorSignature> signature;
auto info = MakeAccessorInfo(name, getter, setter, data, settings, attributes,
signature);
if (info.is_null()) return Nothing<bool>();
bool fast = Utils::OpenHandle(obj)->HasFastProperties();
bool fast = obj->HasFastProperties();
i::Handle<i::Object> result;
has_pending_exception =
!i::JSObject::SetAccessor(Utils::OpenHandle(obj), info).ToHandle(&result);
!i::JSObject::SetAccessor(obj, info).ToHandle(&result);
RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
if (result->IsUndefined()) return Nothing<bool>();
if (fast) {
i::JSObject::MigrateSlowToFast(Utils::OpenHandle(obj), 0, "APISetAccessor");
i::JSObject::MigrateSlowToFast(obj, 0, "APISetAccessor");
}
return Just(true);
}
@ -4005,13 +4010,13 @@ void Object::SetAccessorProperty(Local<Name> name, Local<Function> getter,
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ENTER_V8(isolate);
i::HandleScope scope(isolate);
auto self = Utils::OpenHandle(this);
if (!self->IsJSObject()) return;
i::Handle<i::Object> getter_i = v8::Utils::OpenHandle(*getter);
i::Handle<i::Object> setter_i = v8::Utils::OpenHandle(*setter, true);
if (setter_i.is_null()) setter_i = isolate->factory()->null_value();
i::JSObject::DefineAccessor(v8::Utils::OpenHandle(this),
v8::Utils::OpenHandle(*name),
getter_i,
setter_i,
i::JSObject::DefineAccessor(i::Handle<i::JSObject>::cast(self),
v8::Utils::OpenHandle(*name), getter_i, setter_i,
static_cast<PropertyAttributes>(attribute));
}
@ -4040,8 +4045,10 @@ Maybe<bool> v8::Object::HasRealNamedProperty(Local<Context> context,
PREPARE_FOR_EXECUTION_PRIMITIVE(context, "v8::Object::HasRealNamedProperty()",
bool);
auto self = Utils::OpenHandle(this);
if (!self->IsJSObject()) return Just(false);
auto key_val = Utils::OpenHandle(*key);
auto result = i::JSObject::HasRealNamedProperty(self, key_val);
auto result = i::JSObject::HasRealNamedProperty(
i::Handle<i::JSObject>::cast(self), key_val);
has_pending_exception = result.IsNothing();
RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
return result;
@ -4059,7 +4066,9 @@ Maybe<bool> v8::Object::HasRealIndexedProperty(Local<Context> context,
PREPARE_FOR_EXECUTION_PRIMITIVE(context,
"v8::Object::HasRealIndexedProperty()", bool);
auto self = Utils::OpenHandle(this);
auto result = i::JSObject::HasRealElementProperty(self, index);
if (!self->IsJSObject()) return Just(false);
auto result = i::JSObject::HasRealElementProperty(
i::Handle<i::JSObject>::cast(self), index);
has_pending_exception = result.IsNothing();
RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
return result;
@ -4077,8 +4086,10 @@ Maybe<bool> v8::Object::HasRealNamedCallbackProperty(Local<Context> context,
PREPARE_FOR_EXECUTION_PRIMITIVE(
context, "v8::Object::HasRealNamedCallbackProperty()", bool);
auto self = Utils::OpenHandle(this);
if (!self->IsJSObject()) return Just(false);
auto key_val = Utils::OpenHandle(*key);
auto result = i::JSObject::HasRealNamedCallbackProperty(self, key_val);
auto result = i::JSObject::HasRealNamedCallbackProperty(
i::Handle<i::JSObject>::cast(self), key_val);
has_pending_exception = result.IsNothing();
RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
return result;
@ -4093,13 +4104,15 @@ bool v8::Object::HasRealNamedCallbackProperty(Local<String> key) {
bool v8::Object::HasNamedLookupInterceptor() {
auto self = Utils::OpenHandle(this);
return self->HasNamedInterceptor();
return self->IsJSObject() &&
i::Handle<i::JSObject>::cast(self)->HasNamedInterceptor();
}
bool v8::Object::HasIndexedLookupInterceptor() {
auto self = Utils::OpenHandle(this);
return self->HasIndexedInterceptor();
return self->IsJSObject() &&
i::Handle<i::JSObject>::cast(self)->HasIndexedInterceptor();
}
@ -4107,7 +4120,8 @@ MaybeLocal<Value> v8::Object::GetRealNamedPropertyInPrototypeChain(
Local<Context> context, Local<Name> key) {
PREPARE_FOR_EXECUTION(
context, "v8::Object::GetRealNamedPropertyInPrototypeChain()", Value);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::JSReceiver> self = Utils::OpenHandle(this);
if (!self->IsJSObject()) return MaybeLocal<Value>();
i::Handle<i::Name> key_obj = Utils::OpenHandle(*key);
i::PrototypeIterator iter(isolate, self);
if (iter.IsAtEnd()) return MaybeLocal<Value>();
@ -4138,7 +4152,8 @@ v8::Object::GetRealNamedPropertyAttributesInPrototypeChain(
PREPARE_FOR_EXECUTION_PRIMITIVE(
context, "v8::Object::GetRealNamedPropertyAttributesInPrototypeChain()",
PropertyAttribute);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::JSReceiver> self = Utils::OpenHandle(this);
if (!self->IsJSObject()) return Nothing<PropertyAttribute>();
i::Handle<i::Name> key_obj = Utils::OpenHandle(*key);
i::PrototypeIterator iter(isolate, self);
if (iter.IsAtEnd()) return Nothing<PropertyAttribute>();
@ -4213,7 +4228,7 @@ Maybe<PropertyAttribute> v8::Object::GetRealNamedPropertyAttributes(
Local<v8::Object> v8::Object::Clone() {
auto self = Utils::OpenHandle(this);
auto self = i::Handle<i::JSObject>::cast(Utils::OpenHandle(this));
auto isolate = self->GetIsolate();
ENTER_V8(isolate);
auto result = isolate->factory()->CopyJSObject(self);
@ -4242,17 +4257,19 @@ bool v8::Object::SetHiddenValue(v8::Local<v8::String> key,
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ENTER_V8(isolate);
i::HandleScope scope(isolate);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::JSReceiver> self = Utils::OpenHandle(this);
if (!self->IsJSObject()) return false;
i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
i::Handle<i::String> key_string =
isolate->factory()->InternalizeString(key_obj);
if (value.IsEmpty()) {
i::JSObject::DeleteHiddenProperty(self, key_string);
i::JSObject::DeleteHiddenProperty(i::Handle<i::JSObject>::cast(self),
key_string);
return true;
}
i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
i::Handle<i::Object> result =
i::JSObject::SetHiddenProperty(self, key_string, value_obj);
i::Handle<i::Object> result = i::JSObject::SetHiddenProperty(
i::Handle<i::JSObject>::cast(self), key_string, value_obj);
return *result == *self;
}
@ -4260,11 +4277,14 @@ bool v8::Object::SetHiddenValue(v8::Local<v8::String> key,
v8::Local<v8::Value> v8::Object::GetHiddenValue(v8::Local<v8::String> key) {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ENTER_V8(isolate);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::JSReceiver> self = Utils::OpenHandle(this);
if (!self->IsJSObject()) return v8::Local<v8::Value>();
i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
i::Handle<i::String> key_string =
isolate->factory()->InternalizeString(key_obj);
i::Handle<i::Object> result(self->GetHiddenProperty(key_string), isolate);
i::Handle<i::Object> result(
i::Handle<i::JSObject>::cast(self)->GetHiddenProperty(key_string),
isolate);
if (result->IsTheHole()) return v8::Local<v8::Value>();
return Utils::ToLocal(result);
}
@ -4274,11 +4294,13 @@ bool v8::Object::DeleteHiddenValue(v8::Local<v8::String> key) {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ENTER_V8(isolate);
i::HandleScope scope(isolate);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::JSReceiver> self = Utils::OpenHandle(this);
if (!self->IsJSObject()) return false;
i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
i::Handle<i::String> key_string =
isolate->factory()->InternalizeString(key_obj);
i::JSObject::DeleteHiddenProperty(self, key_string);
i::JSObject::DeleteHiddenProperty(i::Handle<i::JSObject>::cast(self),
key_string);
return true;
}
@ -5302,51 +5324,56 @@ uint32_t Uint32::Value() const {
int v8::Object::InternalFieldCount() {
i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
return obj->GetInternalFieldCount();
i::Handle<i::JSReceiver> self = Utils::OpenHandle(this);
if (!self->IsJSObject()) return 0;
return i::Handle<i::JSObject>::cast(self)->GetInternalFieldCount();
}
static bool InternalFieldOK(i::Handle<i::JSObject> obj,
int index,
static bool InternalFieldOK(i::Handle<i::JSReceiver> obj, int index,
const char* location) {
return Utils::ApiCheck(index < obj->GetInternalFieldCount(),
location,
"Internal field out of bounds");
return Utils::ApiCheck(
obj->IsJSObject() &&
(index < i::Handle<i::JSObject>::cast(obj)->GetInternalFieldCount()),
location, "Internal field out of bounds");
}
Local<Value> v8::Object::SlowGetInternalField(int index) {
i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
i::Handle<i::JSReceiver> obj = Utils::OpenHandle(this);
const char* location = "v8::Object::GetInternalField()";
if (!InternalFieldOK(obj, index, location)) return Local<Value>();
i::Handle<i::Object> value(obj->GetInternalField(index), obj->GetIsolate());
i::Handle<i::Object> value(
i::Handle<i::JSObject>::cast(obj)->GetInternalField(index),
obj->GetIsolate());
return Utils::ToLocal(value);
}
void v8::Object::SetInternalField(int index, v8::Local<Value> value) {
i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
i::Handle<i::JSReceiver> obj = Utils::OpenHandle(this);
const char* location = "v8::Object::SetInternalField()";
if (!InternalFieldOK(obj, index, location)) return;
i::Handle<i::Object> val = Utils::OpenHandle(*value);
obj->SetInternalField(index, *val);
i::Handle<i::JSObject>::cast(obj)->SetInternalField(index, *val);
}
void* v8::Object::SlowGetAlignedPointerFromInternalField(int index) {
i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
i::Handle<i::JSReceiver> obj = Utils::OpenHandle(this);
const char* location = "v8::Object::GetAlignedPointerFromInternalField()";
if (!InternalFieldOK(obj, index, location)) return NULL;
return DecodeSmiToAligned(obj->GetInternalField(index), location);
return DecodeSmiToAligned(
i::Handle<i::JSObject>::cast(obj)->GetInternalField(index), location);
}
void v8::Object::SetAlignedPointerInInternalField(int index, void* value) {
i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
i::Handle<i::JSReceiver> obj = Utils::OpenHandle(this);
const char* location = "v8::Object::SetAlignedPointerInInternalField()";
if (!InternalFieldOK(obj, index, location)) return;
obj->SetInternalField(index, EncodeAlignedAsSmi(value, location));
i::Handle<i::JSObject>::cast(obj)
->SetInternalField(index, EncodeAlignedAsSmi(value, location));
DCHECK_EQ(value, GetAlignedPointerFromInternalField(index));
}
@ -6426,7 +6453,7 @@ Local<Promise::Resolver> Promise::Resolver::New(Isolate* isolate) {
Local<Promise> Promise::Resolver::GetPromise() {
i::Handle<i::JSObject> promise = Utils::OpenHandle(this);
i::Handle<i::JSReceiver> promise = Utils::OpenHandle(this);
return Local<Promise>::Cast(Utils::ToLocal(promise));
}
@ -6534,7 +6561,7 @@ Local<Promise> Promise::Then(Local<Function> handler) {
bool Promise::HasHandler() {
i::Handle<i::JSObject> promise = Utils::OpenHandle(this);
i::Handle<i::JSReceiver> promise = Utils::OpenHandle(this);
i::Isolate* isolate = promise->GetIsolate();
LOG_API(isolate, "Promise::HasRejectHandler");
ENTER_V8(isolate);
@ -7819,8 +7846,9 @@ MaybeLocal<Value> Debug::GetMirror(Local<Context> context,
const int kArgc = 1;
v8::Local<v8::Value> argv[kArgc] = {obj};
Local<Value> result;
has_pending_exception = !v8_fun->Call(context, Utils::ToLocal(debug), kArgc,
argv).ToLocal(&result);
has_pending_exception =
!v8_fun->Call(context, Utils::ToLocal(debug), kArgc, argv)
.ToLocal(&result);
RETURN_ON_FAILED_EXECUTION(Value);
RETURN_ESCAPED(result);
}

View File

@ -145,7 +145,7 @@ class RegisteredExtension {
V(TypeSwitch, TypeSwitchInfo) \
V(Data, Object) \
V(RegExp, JSRegExp) \
V(Object, JSObject) \
V(Object, JSReceiver) \
V(Array, JSArray) \
V(Map, JSMap) \
V(Set, JSSet) \
@ -200,8 +200,12 @@ class Utils {
v8::internal::Handle<v8::internal::Symbol> obj);
static inline Local<RegExp> ToLocal(
v8::internal::Handle<v8::internal::JSRegExp> obj);
static inline Local<Object> ToLocal(
v8::internal::Handle<v8::internal::JSReceiver> obj);
static inline Local<Object> ToLocal(
v8::internal::Handle<v8::internal::JSObject> obj);
static inline Local<Object> ToLocal(
v8::internal::Handle<v8::internal::JSProxy> obj);
static inline Local<Array> ToLocal(
v8::internal::Handle<v8::internal::JSArray> obj);
static inline Local<Map> ToLocal(
@ -353,7 +357,9 @@ MAKE_TO_LOCAL(ToLocal, Name, Name)
MAKE_TO_LOCAL(ToLocal, String, String)
MAKE_TO_LOCAL(ToLocal, Symbol, Symbol)
MAKE_TO_LOCAL(ToLocal, JSRegExp, RegExp)
MAKE_TO_LOCAL(ToLocal, JSReceiver, Object)
MAKE_TO_LOCAL(ToLocal, JSObject, Object)
MAKE_TO_LOCAL(ToLocal, JSProxy, Object)
MAKE_TO_LOCAL(ToLocal, JSArray, Array)
MAKE_TO_LOCAL(ToLocal, JSMap, Map)
MAKE_TO_LOCAL(ToLocal, JSSet, Set)

View File

@ -2249,6 +2249,21 @@ String* JSReceiver::constructor_name() {
}
Context* JSReceiver::GetCreationContext() {
Object* constructor = map()->GetConstructor();
JSFunction* function;
if (!constructor->IsJSFunction()) {
// Functions have null as a constructor,
// but any JSFunction knows its context immediately.
function = JSFunction::cast(this);
} else {
function = JSFunction::cast(constructor);
}
return function->context()->native_context();
}
static Handle<Object> WrapType(Handle<HeapType> type) {
if (type->IsClass()) return Map::WeakCellForMap(type->AsClass()->Map());
return type;
@ -2353,21 +2368,6 @@ void JSObject::AddSlowProperty(Handle<JSObject> object,
}
Context* JSObject::GetCreationContext() {
Object* constructor = this->map()->GetConstructor();
JSFunction* function;
if (!constructor->IsJSFunction()) {
// Functions have null as a constructor,
// but any JSFunction knows its context immediately.
function = JSFunction::cast(this);
} else {
function = JSFunction::cast(constructor);
}
return function->context()->native_context();
}
MaybeHandle<Object> JSObject::EnqueueChangeRecord(Handle<JSObject> object,
const char* type_str,
Handle<Name> name,
@ -6495,6 +6495,15 @@ bool JSReceiver::ValidateAndApplyPropertyDescriptor(
}
// static
Maybe<bool> JSReceiver::CreateDataProperty(LookupIterator* it,
Handle<Object> value) {
// TODO(rossberg): Support proxies.
if (!it->GetReceiver()->IsJSObject()) return Nothing<bool>();
return JSObject::CreateDataProperty(it, value);
}
// TODO(jkummerow): Consider unification with FastAsArrayLength() in
// accessors.cc.
bool PropertyKeyToArrayLength(Handle<Object> value, uint32_t* length) {
@ -14868,9 +14877,11 @@ MaybeHandle<JSObject> JSObject::GetKeysForNamedInterceptor(
}
if (result.IsEmpty()) return MaybeHandle<JSObject>();
DCHECK(v8::Utils::OpenHandle(*result)->IsJSArray() ||
v8::Utils::OpenHandle(*result)->HasSloppyArgumentsElements());
(v8::Utils::OpenHandle(*result)->IsJSObject() &&
Handle<JSObject>::cast(v8::Utils::OpenHandle(*result))
->HasSloppyArgumentsElements()));
// Rebox before returning.
return handle(*v8::Utils::OpenHandle(*result), isolate);
return handle(JSObject::cast(*v8::Utils::OpenHandle(*result)), isolate);
}
@ -14891,9 +14902,11 @@ MaybeHandle<JSObject> JSObject::GetKeysForIndexedInterceptor(
}
if (result.IsEmpty()) return MaybeHandle<JSObject>();
DCHECK(v8::Utils::OpenHandle(*result)->IsJSArray() ||
v8::Utils::OpenHandle(*result)->HasSloppyArgumentsElements());
(v8::Utils::OpenHandle(*result)->IsJSObject() &&
Handle<JSObject>::cast(v8::Utils::OpenHandle(*result))
->HasSloppyArgumentsElements()));
// Rebox before returning.
return handle(*v8::Utils::OpenHandle(*result), isolate);
return handle(JSObject::cast(*v8::Utils::OpenHandle(*result)), isolate);
}

View File

@ -1833,6 +1833,10 @@ class JSReceiver: public HeapObject {
Handle<Object> key, PropertyDescriptor* desc,
ShouldThrow should_throw);
// "virtual" dispatcher to the correct [[CreateDataProperty]] implementation.
MUST_USE_RESULT static Maybe<bool> CreateDataProperty(LookupIterator* it,
Handle<Object> value);
// ES6 9.1.6.1
static bool OrdinaryDefineOwnProperty(Isolate* isolate,
Handle<JSObject> object,
@ -1879,6 +1883,8 @@ class JSReceiver: public HeapObject {
// function that was used to instantiate the object).
String* constructor_name();
Context* GetCreationContext();
MUST_USE_RESULT static inline Maybe<PropertyAttributes> GetPropertyAttributes(
Handle<JSReceiver> object, Handle<Name> name);
MUST_USE_RESULT static inline Maybe<PropertyAttributes>
@ -2463,8 +2469,6 @@ class JSObject: public JSReceiver {
typedef FlexibleBodyDescriptor<kPropertiesOffset> BodyDescriptor;
Context* GetCreationContext();
// Enqueue change record for Object.observe. May cause GC.
MUST_USE_RESULT static MaybeHandle<Object> EnqueueChangeRecord(
Handle<JSObject> object, const char* type, Handle<Name> name,

View File

@ -124,8 +124,8 @@ class FunctionTester : public InitializedHandleScope {
}
Handle<JSObject> NewObject(const char* source) {
return v8::Utils::OpenHandle(
*v8::Local<v8::Object>::Cast(CompileRun(source)));
return Handle<JSObject>::cast(v8::Utils::OpenHandle(
*v8::Local<v8::Object>::Cast(CompileRun(source))));
}
Handle<String> Val(const char* string) {

View File

@ -1582,7 +1582,8 @@ void SloppyArgsIndexedPropertyEnumerator(
Local<Object> result =
Local<Object>::Cast(indexed_property_names_script->Run());
// Have to populate the handle manually, as it's not Cast-able.
i::Handle<i::JSObject> o = v8::Utils::OpenHandle<Object, i::JSObject>(result);
i::Handle<i::JSReceiver> o =
v8::Utils::OpenHandle<Object, i::JSReceiver>(result);
i::Handle<i::JSArray> array(reinterpret_cast<i::JSArray*>(*o));
info.GetReturnValue().Set(v8::Utils::ToLocal(array));
}

View File

@ -1928,7 +1928,7 @@ THREADED_TEST(ExecutableAccessorIsPreservedOnAttributeChange) {
v8::HandleScope scope(isolate);
LocalContext env;
v8::Local<v8::Value> res = CompileRun("var a = []; a;");
i::Handle<i::JSObject> a(v8::Utils::OpenHandle(v8::Object::Cast(*res)));
i::Handle<i::JSReceiver> a(v8::Utils::OpenHandle(v8::Object::Cast(*res)));
CHECK(a->map()->instance_descriptors()->IsFixedArray());
CHECK_GT(i::FixedArray::cast(a->map()->instance_descriptors())->length(), 0);
CompileRun("Object.defineProperty(a, 'length', { writable: false });");
@ -9730,7 +9730,7 @@ THREADED_TEST(Constructor) {
Local<Function> cons = templ->GetFunction();
context->Global()->Set(v8_str("Fun"), cons);
Local<v8::Object> inst = cons->NewInstance();
i::Handle<i::JSObject> obj(v8::Utils::OpenHandle(*inst));
i::Handle<i::JSReceiver> obj(v8::Utils::OpenHandle(*inst));
CHECK(obj->IsJSObject());
Local<Value> value = CompileRun("(new Fun()).constructor === Fun");
CHECK(value->BooleanValue());
@ -13741,7 +13741,7 @@ static void ObjectWithExternalArrayTestHelper(Handle<Context> context,
int element_count,
i::ExternalArrayType array_type,
int64_t low, int64_t high) {
i::Handle<i::JSObject> jsobj = v8::Utils::OpenHandle(*obj);
i::Handle<i::JSReceiver> jsobj = v8::Utils::OpenHandle(*obj);
i::Isolate* isolate = jsobj->GetIsolate();
obj->Set(v8_str("field"),
v8::Int32::New(reinterpret_cast<v8::Isolate*>(isolate), 1503));
@ -13971,8 +13971,8 @@ static void ObjectWithExternalArrayTestHelper(Handle<Context> context,
CHECK_EQ(true, result->BooleanValue());
}
i::Handle<ExternalArrayClass> array(
ExternalArrayClass::cast(jsobj->elements()));
i::Handle<ExternalArrayClass> array(ExternalArrayClass::cast(
i::Handle<i::JSObject>::cast(jsobj)->elements()));
for (int i = 0; i < element_count; i++) {
array->set(i, static_cast<ElementType>(i));
}

View File

@ -1829,31 +1829,37 @@ TEST(GetConstructorName) {
v8::Local<v8::Object> js_global =
env->Global()->GetPrototype().As<v8::Object>();
v8::Local<v8::Object> obj1 = js_global->Get(v8_str("obj1")).As<v8::Object>();
i::Handle<i::JSObject> js_obj1 = v8::Utils::OpenHandle(*obj1);
i::Handle<i::JSObject> js_obj1 =
i::Handle<i::JSObject>::cast(v8::Utils::OpenHandle(*obj1));
CHECK_EQ(0, StringCmp(
"Constructor1", i::V8HeapExplorer::GetConstructorName(*js_obj1)));
v8::Local<v8::Object> obj2 = js_global->Get(v8_str("obj2")).As<v8::Object>();
i::Handle<i::JSObject> js_obj2 = v8::Utils::OpenHandle(*obj2);
i::Handle<i::JSObject> js_obj2 =
i::Handle<i::JSObject>::cast(v8::Utils::OpenHandle(*obj2));
CHECK_EQ(0, StringCmp(
"Constructor2", i::V8HeapExplorer::GetConstructorName(*js_obj2)));
v8::Local<v8::Object> obj3 = js_global->Get(v8_str("obj3")).As<v8::Object>();
i::Handle<i::JSObject> js_obj3 = v8::Utils::OpenHandle(*obj3);
i::Handle<i::JSObject> js_obj3 =
i::Handle<i::JSObject>::cast(v8::Utils::OpenHandle(*obj3));
// TODO(verwaest): Restore to Constructor3 once supported by the
// heap-snapshot-generator.
CHECK_EQ(
0, StringCmp("Object", i::V8HeapExplorer::GetConstructorName(*js_obj3)));
v8::Local<v8::Object> obj4 = js_global->Get(v8_str("obj4")).As<v8::Object>();
i::Handle<i::JSObject> js_obj4 = v8::Utils::OpenHandle(*obj4);
i::Handle<i::JSObject> js_obj4 =
i::Handle<i::JSObject>::cast(v8::Utils::OpenHandle(*obj4));
// TODO(verwaest): Restore to Constructor4 once supported by the
// heap-snapshot-generator.
CHECK_EQ(
0, StringCmp("Object", i::V8HeapExplorer::GetConstructorName(*js_obj4)));
v8::Local<v8::Object> obj5 = js_global->Get(v8_str("obj5")).As<v8::Object>();
i::Handle<i::JSObject> js_obj5 = v8::Utils::OpenHandle(*obj5);
i::Handle<i::JSObject> js_obj5 =
i::Handle<i::JSObject>::cast(v8::Utils::OpenHandle(*obj5));
CHECK_EQ(0, StringCmp(
"Object", i::V8HeapExplorer::GetConstructorName(*js_obj5)));
v8::Local<v8::Object> obj6 = js_global->Get(v8_str("obj6")).As<v8::Object>();
i::Handle<i::JSObject> js_obj6 = v8::Utils::OpenHandle(*obj6);
i::Handle<i::JSObject> js_obj6 =
i::Handle<i::JSObject>::cast(v8::Utils::OpenHandle(*obj6));
CHECK_EQ(0, StringCmp(
"Object", i::V8HeapExplorer::GetConstructorName(*js_obj6)));
}
@ -1912,7 +1918,7 @@ TEST(FastCaseRedefinedAccessors) {
"});\n");
v8::Local<v8::Object> js_global =
env->Global()->GetPrototype().As<v8::Object>();
i::Handle<i::JSObject> js_obj1 =
i::Handle<i::JSReceiver> js_obj1 =
v8::Utils::OpenHandle(*js_global->Get(v8_str("obj1")).As<v8::Object>());
USE(js_obj1);

View File

@ -2635,7 +2635,7 @@ TEST(PrototypeTransitionClearing) {
v8::Local<v8::Context> ctx = CcTest::isolate()->GetCurrentContext();
CompileRun("var base = {};");
i::Handle<JSObject> baseObject =
i::Handle<JSReceiver> baseObject =
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(
CcTest::global()->Get(ctx, v8_str("base")).ToLocalChecked()));
@ -2877,7 +2877,7 @@ TEST(OptimizedAllocationAlwaysInNewSpace) {
->Int32Value(ctx)
.FromJust());
i::Handle<JSObject> o =
i::Handle<JSReceiver> o =
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(res));
CHECK(CcTest::heap()->InNewSpace(*o));
@ -2918,14 +2918,14 @@ TEST(OptimizedPretenuringAllocationFolding) {
v8::Local<v8::Value> int_array =
v8::Object::Cast(*res)->Get(ctx, v8_str("0")).ToLocalChecked();
i::Handle<JSObject> int_array_handle =
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(int_array));
i::Handle<JSObject> int_array_handle = i::Handle<JSObject>::cast(
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(int_array)));
v8::Local<v8::Value> double_array =
v8::Object::Cast(*res)->Get(ctx, v8_str("1")).ToLocalChecked();
i::Handle<JSObject> double_array_handle =
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(double_array));
i::Handle<JSObject> double_array_handle = i::Handle<JSObject>::cast(
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(double_array)));
i::Handle<JSObject> o =
i::Handle<JSReceiver> o =
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(res));
CHECK(CcTest::heap()->InOldSpace(*o));
CHECK(CcTest::heap()->InOldSpace(*int_array_handle));
@ -2967,8 +2967,8 @@ TEST(OptimizedPretenuringObjectArrayLiterals) {
v8::Local<v8::Value> res = CompileRun(source.start());
i::Handle<JSObject> o =
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(res));
i::Handle<JSObject> o = Handle<JSObject>::cast(
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(res)));
CHECK(CcTest::heap()->InOldSpace(o->elements()));
CHECK(CcTest::heap()->InOldSpace(*o));
@ -3008,8 +3008,8 @@ TEST(OptimizedPretenuringMixedInObjectProperties) {
v8::Local<v8::Value> res = CompileRun(source.start());
i::Handle<JSObject> o =
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(res));
i::Handle<JSObject> o = Handle<JSObject>::cast(
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(res)));
CHECK(CcTest::heap()->InOldSpace(*o));
FieldIndex idx1 = FieldIndex::ForPropertyIndex(o->map(), 0);
@ -3065,8 +3065,8 @@ TEST(OptimizedPretenuringDoubleArrayProperties) {
v8::Local<v8::Value> res = CompileRun(source.start());
i::Handle<JSObject> o =
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(res));
i::Handle<JSObject> o = Handle<JSObject>::cast(
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(res)));
CHECK(CcTest::heap()->InOldSpace(*o));
CHECK(CcTest::heap()->InOldSpace(o->properties()));
@ -3105,8 +3105,8 @@ TEST(OptimizedPretenuringdoubleArrayLiterals) {
v8::Local<v8::Value> res = CompileRun(source.start());
i::Handle<JSObject> o =
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(res));
i::Handle<JSObject> o = Handle<JSObject>::cast(
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(res)));
CHECK(CcTest::heap()->InOldSpace(o->elements()));
CHECK(CcTest::heap()->InOldSpace(*o));
@ -3146,14 +3146,15 @@ TEST(OptimizedPretenuringNestedMixedArrayLiterals) {
v8::Local<v8::Value> int_array =
v8::Object::Cast(*res)->Get(ctx, v8_str("0")).ToLocalChecked();
i::Handle<JSObject> int_array_handle =
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(int_array));
i::Handle<JSObject> int_array_handle = i::Handle<JSObject>::cast(
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(int_array)));
v8::Local<v8::Value> double_array =
v8::Object::Cast(*res)->Get(ctx, v8_str("1")).ToLocalChecked();
i::Handle<JSObject> double_array_handle =
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(double_array));
i::Handle<JSObject> double_array_handle = i::Handle<JSObject>::cast(
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(double_array)));
Handle<JSObject> o = v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(res));
Handle<JSObject> o = Handle<JSObject>::cast(
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(res)));
CHECK(CcTest::heap()->InOldSpace(*o));
CHECK(CcTest::heap()->InOldSpace(*int_array_handle));
CHECK(CcTest::heap()->InOldSpace(int_array_handle->elements()));
@ -3196,14 +3197,15 @@ TEST(OptimizedPretenuringNestedObjectLiterals) {
v8::Local<v8::Value> int_array_1 =
v8::Object::Cast(*res)->Get(ctx, v8_str("0")).ToLocalChecked();
Handle<JSObject> int_array_handle_1 =
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(int_array_1));
Handle<JSObject> int_array_handle_1 = Handle<JSObject>::cast(
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(int_array_1)));
v8::Local<v8::Value> int_array_2 =
v8::Object::Cast(*res)->Get(ctx, v8_str("1")).ToLocalChecked();
Handle<JSObject> int_array_handle_2 =
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(int_array_2));
Handle<JSObject> int_array_handle_2 = Handle<JSObject>::cast(
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(int_array_2)));
Handle<JSObject> o = v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(res));
Handle<JSObject> o = Handle<JSObject>::cast(
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(res)));
CHECK(CcTest::heap()->InOldSpace(*o));
CHECK(CcTest::heap()->InOldSpace(*int_array_handle_1));
CHECK(CcTest::heap()->InOldSpace(int_array_handle_1->elements()));
@ -3246,15 +3248,15 @@ TEST(OptimizedPretenuringNestedDoubleLiterals) {
v8::Local<v8::Value> double_array_1 =
v8::Object::Cast(*res)->Get(ctx, v8_str("0")).ToLocalChecked();
i::Handle<JSObject> double_array_handle_1 =
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(double_array_1));
i::Handle<JSObject> double_array_handle_1 = i::Handle<JSObject>::cast(
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(double_array_1)));
v8::Local<v8::Value> double_array_2 =
v8::Object::Cast(*res)->Get(ctx, v8_str("1")).ToLocalChecked();
i::Handle<JSObject> double_array_handle_2 =
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(double_array_2));
i::Handle<JSObject> double_array_handle_2 = Handle<JSObject>::cast(
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(double_array_2)));
i::Handle<JSObject> o =
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(res));
i::Handle<JSObject> o = Handle<JSObject>::cast(
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(res)));
CHECK(CcTest::heap()->InOldSpace(*o));
CHECK(CcTest::heap()->InOldSpace(*double_array_handle_1));
CHECK(CcTest::heap()->InOldSpace(double_array_handle_1->elements()));
@ -3286,8 +3288,8 @@ TEST(OptimizedAllocationArrayLiterals) {
->Int32Value(ctx)
.FromJust());
i::Handle<JSObject> o =
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(res));
i::Handle<JSObject> o = Handle<JSObject>::cast(
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(res)));
CHECK(CcTest::heap()->InNewSpace(o->elements()));
}
@ -3321,8 +3323,9 @@ TEST(Regress1465) {
CompileRun("var root = new F;");
}
i::Handle<JSObject> root = v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(
CcTest::global()->Get(ctx, v8_str("root")).ToLocalChecked()));
i::Handle<JSReceiver> root =
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(
CcTest::global()->Get(ctx, v8_str("root")).ToLocalChecked()));
// Count number of live transitions before marking.
int transitions_before = CountMapTransitions(root->map());
@ -3352,10 +3355,11 @@ static void AddTransitions(int transitions_count) {
static i::Handle<JSObject> GetByName(const char* name) {
return v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(
CcTest::global()
->Get(CcTest::isolate()->GetCurrentContext(), v8_str(name))
.ToLocalChecked()));
return i::Handle<JSObject>::cast(
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(
CcTest::global()
->Get(CcTest::isolate()->GetCurrentContext(), v8_str(name))
.ToLocalChecked())));
}
@ -3515,7 +3519,7 @@ TEST(Regress2143a) {
// Explicitly request GC to perform final marking step and sweeping.
CcTest::heap()->CollectAllGarbage();
Handle<JSObject> root = v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(
Handle<JSReceiver> root = v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(
CcTest::global()
->Get(CcTest::isolate()->GetCurrentContext(), v8_str("root"))
.ToLocalChecked()));
@ -3558,7 +3562,7 @@ TEST(Regress2143b) {
// Explicitly request GC to perform final marking step and sweeping.
CcTest::heap()->CollectAllGarbage();
Handle<JSObject> root = v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(
Handle<JSReceiver> root = v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(
CcTest::global()
->Get(CcTest::isolate()->GetCurrentContext(), v8_str("root"))
.ToLocalChecked()));
@ -3761,7 +3765,7 @@ TEST(ICInBuiltInIsClearedAppropriately) {
{
LocalContext env;
v8::Local<v8::Value> res = CompileRun("Function.apply");
i::Handle<JSObject> maybe_apply =
i::Handle<JSReceiver> maybe_apply =
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(res));
apply = i::Handle<JSFunction>::cast(maybe_apply);
i::Handle<TypeFeedbackVector> vector(apply->shared()->feedback_vector());
@ -5573,8 +5577,8 @@ TEST(ArrayShiftSweeping) {
"array.shift();"
"array;");
Handle<JSObject> o =
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(result));
Handle<JSObject> o = Handle<JSObject>::cast(
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(result)));
CHECK(heap->InOldSpace(o->elements()));
CHECK(heap->InOldSpace(*o));
Page* page = Page::FromAddress(o->elements()->address());
@ -5722,7 +5726,7 @@ TEST(Regress3631) {
CcTest::heap()->StartIncrementalMarking();
}
// Incrementally mark the backing store.
Handle<JSObject> obj =
Handle<JSReceiver> obj =
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(result));
Handle<JSWeakCollection> weak_map(reinterpret_cast<JSWeakCollection*>(*obj));
while (!Marking::IsBlack(
@ -5782,7 +5786,7 @@ TEST(Regress3877) {
{
HandleScope inner_scope(isolate);
v8::Local<v8::Value> result = CompileRun("cls.prototype");
Handle<JSObject> proto =
Handle<JSReceiver> proto =
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(result));
weak_prototype = inner_scope.CloseAndEscape(factory->NewWeakCell(proto));
}
@ -5810,7 +5814,7 @@ Handle<WeakCell> AddRetainedMap(Isolate* isolate, Heap* heap) {
Handle<Map> map = Map::Create(isolate, 1);
v8::Local<v8::Value> result =
CompileRun("(function () { return {x : 10}; })();");
Handle<JSObject> proto =
Handle<JSReceiver> proto =
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(result));
Map::SetPrototype(map, proto);
heap->AddRetainedMap(map);

View File

@ -144,9 +144,7 @@ static void TestNaN(const char *code) {
v8::Local<v8::Script> script = v8::Script::Compile(v8_str(code));
v8::Local<v8::Object> result = v8::Local<v8::Object>::Cast(script->Run());
// Have to populate the handle manually, as it's not Cast-able.
i::Handle<i::JSObject> o =
v8::Utils::OpenHandle<v8::Object, i::JSObject>(result);
i::Handle<i::JSReceiver> o = v8::Utils::OpenHandle(*result);
i::Handle<i::JSArray> array1(reinterpret_cast<i::JSArray*>(*o));
i::FixedDoubleArray* a = i::FixedDoubleArray::cast(array1->elements());
double value = a->get_scalar(0);

View File

@ -54,10 +54,12 @@ static Handle<String> MakeName(const char* str, int suffix) {
Handle<JSObject> GetObject(const char* name) {
return v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(
CcTest::global()
->Get(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str(name))
.ToLocalChecked()));
return Handle<JSObject>::cast(
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(
CcTest::global()
->Get(v8::Isolate::GetCurrent()->GetCurrentContext(),
v8_str(name))
.ToLocalChecked())));
}