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

Unified Diff: test/cctest/compiler/test-run-jsobjects.cc

Issue 1344553003: [turbofan] Model arguments object materialization in graph. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed 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 | « test/cctest/cctest.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/compiler/test-run-jsobjects.cc
diff --git a/test/cctest/compiler/test-run-jsobjects.cc b/test/cctest/compiler/test-run-jsobjects.cc
new file mode 100644
index 0000000000000000000000000000000000000000..242de4dbf7d3566474d6d1ea2b00147dcb062bfd
--- /dev/null
+++ b/test/cctest/compiler/test-run-jsobjects.cc
@@ -0,0 +1,47 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "test/cctest/compiler/function-tester.h"
+
+using namespace v8::internal;
+using namespace v8::internal::compiler;
+
+TEST(ArgumentsMapped) {
+ FunctionTester T("(function(a) { return arguments; })");
+
+ Handle<Object> arguments;
+ T.Call(T.Val(19), T.Val(23), T.Val(42), T.Val(65)).ToHandle(&arguments);
+ CHECK(arguments->IsJSObject() && !arguments->IsJSArray());
+ CHECK(JSObject::cast(*arguments)->HasSloppyArgumentsElements());
+ Handle<String> l = T.isolate->factory()->length_string();
+ Handle<Object> length = JSObject::GetProperty(arguments, l).ToHandleChecked();
+ CHECK_EQ(4, length->Number());
+}
+
+
+TEST(ArgumentsUnmapped) {
+ FunctionTester T("(function(a) { 'use strict'; return arguments; })");
+
+ Handle<Object> arguments;
+ T.Call(T.Val(19), T.Val(23), T.Val(42), T.Val(65)).ToHandle(&arguments);
+ CHECK(arguments->IsJSObject() && !arguments->IsJSArray());
+ CHECK(!JSObject::cast(*arguments)->HasSloppyArgumentsElements());
+ Handle<String> l = T.isolate->factory()->length_string();
+ Handle<Object> length = JSObject::GetProperty(arguments, l).ToHandleChecked();
+ CHECK_EQ(4, length->Number());
+}
+
+
+TEST(ArgumentsRest) {
+ FLAG_harmony_rest_parameters = true;
+ FunctionTester T("(function(a, ...args) { return args; })");
+
+ Handle<Object> arguments;
+ T.Call(T.Val(19), T.Val(23), T.Val(42), T.Val(65)).ToHandle(&arguments);
+ CHECK(arguments->IsJSObject() && arguments->IsJSArray());
+ CHECK(!JSObject::cast(*arguments)->HasSloppyArgumentsElements());
+ Handle<String> l = T.isolate->factory()->length_string();
+ Handle<Object> length = JSObject::GetProperty(arguments, l).ToHandleChecked();
+ CHECK_EQ(3, length->Number());
+}
« no previous file with comments | « test/cctest/cctest.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698