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

Unified Diff: src/objects.cc

Issue 1307943013: [es5] Class of object is "Function" if object has [[Call]]. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address Jakobs comments. Created 5 years, 3 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
« no previous file with comments | « src/objects.h ('k') | src/x64/lithium-codegen-x64.cc » ('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 c0539c493fa432fc0d8dde8993c02a3ded2c5178..60f1e5bdc955273e4ae56f9049061ad10ea79cbc 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -58,9 +58,9 @@ Handle<HeapType> Object::OptimalType(Isolate* isolate,
if (representation.IsHeapObject() && IsHeapObject()) {
// We can track only JavaScript objects with stable maps.
Handle<Map> map(HeapObject::cast(this)->map(), isolate);
- if (map->is_stable() &&
- map->instance_type() >= FIRST_NONCALLABLE_SPEC_OBJECT_TYPE &&
- map->instance_type() <= LAST_NONCALLABLE_SPEC_OBJECT_TYPE) {
+ if (map->is_stable() && !map->is_callable() &&
+ map->instance_type() >= FIRST_JS_RECEIVER_TYPE &&
+ map->instance_type() <= LAST_JS_RECEIVER_TYPE) {
return HeapType::Class(map, isolate);
}
}
@@ -1650,7 +1650,10 @@ void Simd128Value::CopyBits(void* destination) const {
String* JSReceiver::class_name() {
- if (IsJSFunction() || IsJSFunctionProxy()) {
+ // According to ES5 section 15 Standard Built-in ECMAScript Objects, the
+ // [[Class]] of builtin objects is "Function" if a [[Call]] internal
+ // method is present.
+ if (IsCallable()) {
return GetHeap()->Function_string();
}
Object* maybe_constructor = map()->GetConstructor();
« no previous file with comments | « src/objects.h ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698