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

Unified Diff: src/objects.cc

Issue 1413463006: Map v8::Object to v8::internal::JSReceiver (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.h ('k') | test/cctest/compiler/function-tester.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index f5ad23396b9dd5c6d531c585f9be4ec938a093c9..fefdc5be48dde724d2eeff54368985392a6dc7b3 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -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);
}
« no previous file with comments | « src/objects.h ('k') | test/cctest/compiler/function-tester.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698