Index: src/builtins.cc |
diff --git a/src/builtins.cc b/src/builtins.cc |
index 3119f942eef3b110213ef6fbc4fa69bb9ca827ae..5b3def4ff4d2737d5d6b57d224b8155362e5fb2e 100644 |
--- a/src/builtins.cc |
+++ b/src/builtins.cc |
@@ -351,6 +351,39 @@ BUILTIN(Illegal) { |
BUILTIN(EmptyFunction) { return isolate->heap()->undefined_value(); } |
+void Builtins::Generate_ArrayIsArray(CodeStubAssembler* assembler) { |
+ typedef compiler::Node Node; |
+ typedef CodeStubAssembler::Label Label; |
+ |
+ Node* object = assembler->Parameter(1); |
+ Node* context = assembler->Parameter(4); |
+ |
+ Label call_runtime(assembler), return_true(assembler), |
+ return_false(assembler); |
+ |
+ assembler->GotoIf(assembler->WordIsSmi(object), &return_false); |
+ Node* instance_type = assembler->LoadInstanceType(object); |
+ |
+ assembler->GotoIf(assembler->Word32Equal( |
+ instance_type, assembler->Int32Constant(JS_ARRAY_TYPE)), |
+ &return_true); |
+ |
+ // TODO(verwaest): Handle proxies in-place. |
+ assembler->Branch(assembler->Word32Equal( |
+ instance_type, assembler->Int32Constant(JS_PROXY_TYPE)), |
+ &call_runtime, &return_false); |
+ |
+ assembler->Bind(&return_true); |
+ assembler->Return(assembler->BooleanConstant(true)); |
+ |
+ assembler->Bind(&return_false); |
+ assembler->Return(assembler->BooleanConstant(false)); |
+ |
+ assembler->Bind(&call_runtime); |
+ assembler->Return( |
+ assembler->CallRuntime(Runtime::kArrayIsArray, context, object)); |
+} |
+ |
void Builtins::Generate_ObjectHasOwnProperty(CodeStubAssembler* assembler) { |
typedef compiler::Node Node; |
typedef CodeStubAssembler::Label Label; |
@@ -1609,16 +1642,6 @@ BUILTIN(ArrayConcat) { |
} |
-// ES6 22.1.2.2 Array.isArray |
-BUILTIN(ArrayIsArray) { |
- HandleScope scope(isolate); |
- DCHECK_EQ(2, args.length()); |
- Handle<Object> object = args.at<Object>(1); |
- Maybe<bool> result = Object::IsArray(object); |
- MAYBE_RETURN(result, isolate->heap()->exception()); |
- return *isolate->factory()->ToBoolean(result.FromJust()); |
-} |
- |
namespace { |
MUST_USE_RESULT Maybe<bool> FastAssign(Handle<JSReceiver> to, |