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

Unified Diff: src/objects.cc

Issue 1316933002: [es6] Initial steps towards a correct implementation of IsCallable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase again. 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/objects-debug.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 4214c8b78d63d6f83764629a9491ded7f1b449b1..c0539c493fa432fc0d8dde8993c02a3ded2c5178 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -176,14 +176,20 @@ bool Object::StrictEquals(Object* that) {
}
-bool Object::IsCallable() const {
- const Object* fun = this;
- while (fun->IsJSFunctionProxy()) {
- fun = JSFunctionProxy::cast(fun)->call_trap();
+// static
+Handle<String> Object::TypeOf(Isolate* isolate, Handle<Object> object) {
+ if (object->IsNumber()) return isolate->factory()->number_string();
+ if (object->IsUndefined() || object->IsUndetectableObject()) {
+ return isolate->factory()->undefined_string();
}
- return fun->IsJSFunction() ||
- (fun->IsHeapObject() &&
- HeapObject::cast(fun)->map()->has_instance_call_handler());
+ if (object->IsBoolean()) return isolate->factory()->boolean_string();
+ if (object->IsSymbol()) return isolate->factory()->symbol_string();
+#define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \
+ if (object->Is##Type()) return isolate->factory()->type##_string();
+ SIMD128_TYPES(SIMD128_TYPE)
+#undef SIMD128_TYPE
+ if (object->IsCallable()) return isolate->factory()->function_string();
+ return isolate->factory()->object_string();
}
@@ -9527,17 +9533,20 @@ int Map::Hash() {
}
-static bool CheckEquivalent(Map* first, Map* second) {
+namespace {
+
+bool CheckEquivalent(Map* first, Map* second) {
return first->GetConstructor() == second->GetConstructor() &&
first->prototype() == second->prototype() &&
first->instance_type() == second->instance_type() &&
first->bit_field() == second->bit_field() &&
first->is_extensible() == second->is_extensible() &&
first->is_strong() == second->is_strong() &&
- first->has_instance_call_handler() ==
- second->has_instance_call_handler();
+ first->is_hidden_prototype() == second->is_hidden_prototype();
}
+} // namespace
+
bool Map::EquivalentToForTransition(Map* other) {
return CheckEquivalent(this, other);
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698