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

Unified Diff: src/objects-inl.h

Issue 1306303003: [es6] Implement spec compliant ToPrimitive in the runtime. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address Michis comments. Created 5 years, 4 months 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
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 57750c3459187f53f3bf43bda562d0bf3baeeaac..a37fcd58369c83a7fcb4be93efa62cd8eb658656 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -1132,6 +1132,7 @@ bool Object::FitsRepresentation(Representation representation) {
}
+// static
MaybeHandle<JSReceiver> Object::ToObject(Isolate* isolate,
Handle<Object> object) {
return ToObject(
@@ -1139,6 +1140,21 @@ MaybeHandle<JSReceiver> Object::ToObject(Isolate* isolate,
}
+// static
+MaybeHandle<Name> Object::ToName(Isolate* isolate, Handle<Object> input) {
+ if (input->IsName()) return Handle<Name>::cast(input);
+ return ToString(isolate, input);
+}
+
+
+// static
+MaybeHandle<Object> Object::ToPrimitive(Handle<Object> input,
+ ToPrimitiveHint hint) {
+ if (input->IsPrimitive()) return input;
+ return JSReceiver::ToPrimitive(Handle<JSReceiver>::cast(input), hint);
+}
+
+
bool Object::HasSpecificClassOf(String* name) {
return this->IsJSObject() && (JSObject::cast(this)->class_name() == name);
}
« src/objects.cc ('K') | « src/objects.cc ('k') | src/ppc/code-stubs-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698