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

Unified Diff: src/builtins.cc

Issue 1924233002: Turn Array.isArray into a Turbofan stub (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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/builtins.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « src/builtins.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698