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

Unified Diff: src/objects-inl.h

Issue 1316933002: [es6] Initial steps towards a correct implementation of IsCallable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: ia32, arm and arm64 ports. Misc cleanups. 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 f5f2eaeaad93e3d8960771a902afd80aa111bdad..3b637c4147c3f7eff1efc10fbd804fe0c9f44ca0 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -187,12 +187,18 @@ bool Object::IsUniqueName() const {
}
+bool Object::IsCallable() const {
+ return Object::IsHeapObject() && HeapObject::cast(this)->map()->is_callable();
+}
+
+
bool Object::IsSpecObject() const {
return Object::IsHeapObject()
&& HeapObject::cast(this)->map()->instance_type() >= FIRST_SPEC_OBJECT_TYPE;
}
+// TODO(rossberg): Remove this and use the spec compliant IsCallable instead.
bool Object::IsSpecFunction() const {
if (!Object::IsHeapObject()) return false;
InstanceType type = HeapObject::cast(this)->map()->instance_type();
@@ -4482,12 +4488,12 @@ bool Map::function_with_prototype() {
void Map::set_is_hidden_prototype() {
- set_bit_field(bit_field() | (1 << kIsHiddenPrototype));
+ set_bit_field3(IsHiddenPrototype::update(bit_field3(), true));
}
-bool Map::is_hidden_prototype() {
- return ((1 << kIsHiddenPrototype) & bit_field()) != 0;
+bool Map::is_hidden_prototype() const {
+ return IsHiddenPrototype::decode(bit_field3());
}
@@ -4633,13 +4639,11 @@ bool Map::owns_descriptors() {
}
-void Map::set_has_instance_call_handler() {
- set_bit_field3(HasInstanceCallHandler::update(bit_field3(), true));
-}
+void Map::set_is_callable() { set_bit_field(bit_field() | (1 << kIsCallable)); }
-bool Map::has_instance_call_handler() {
- return HasInstanceCallHandler::decode(bit_field3());
+bool Map::is_callable() const {
+ return ((1 << kIsCallable) & bit_field()) != 0;
}
@@ -6265,7 +6269,7 @@ void JSBuiltinsObject::set_javascript_builtin(Builtins::JavaScript id,
ACCESSORS(JSProxy, handler, Object, kHandlerOffset)
ACCESSORS(JSProxy, hash, Object, kHashOffset)
-ACCESSORS(JSFunctionProxy, call_trap, Object, kCallTrapOffset)
+ACCESSORS(JSFunctionProxy, call_trap, JSReceiver, kCallTrapOffset)
ACCESSORS(JSFunctionProxy, construct_trap, Object, kConstructTrapOffset)

Powered by Google App Engine
This is Rietveld 408576698