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

Side by Side Diff: test/cctest/compiler/test-run-jscalls.cc

Issue 1384443002: [es6] Fix missing bits for full @@toPrimitive support. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove useless cctest. Created 5 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "test/cctest/compiler/function-tester.h" 7 #include "test/cctest/compiler/function-tester.h"
8 8
9 using namespace v8::internal; 9 using namespace v8::internal;
10 using namespace v8::internal::compiler; 10 using namespace v8::internal::compiler;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // TODO(titzer): factor these out into test-runtime-calls.cc 134 // TODO(titzer): factor these out into test-runtime-calls.cc
135 TEST(RuntimeCallCPP2) { 135 TEST(RuntimeCallCPP2) {
136 FLAG_allow_natives_syntax = true; 136 FLAG_allow_natives_syntax = true;
137 FunctionTester T("(function(a,b) { return %NumberImul(a, b); })"); 137 FunctionTester T("(function(a,b) { return %NumberImul(a, b); })");
138 138
139 T.CheckCall(T.Val(2730), T.Val(42), T.Val(65)); 139 T.CheckCall(T.Val(2730), T.Val(42), T.Val(65));
140 T.CheckCall(T.Val(798), T.Val(42), T.Val(19)); 140 T.CheckCall(T.Val(798), T.Val(42), T.Val(19));
141 } 141 }
142 142
143 143
144 TEST(RuntimeCallJS) {
Benedikt Meurer 2015/10/01 13:05:48 Note: There are no "meaningful high level" JS intr
145 FLAG_allow_natives_syntax = true;
146 FunctionTester T("(function(a) { return %to_number_fun(a); })");
147
148 T.CheckCall(T.Val(23), T.Val(23), T.undefined());
149 T.CheckCall(T.Val(4.2), T.Val(4.2), T.undefined());
150 T.CheckCall(T.Val(1), T.true_value(), T.undefined());
151 }
152
153
154 TEST(RuntimeCallInline) { 144 TEST(RuntimeCallInline) {
155 FLAG_allow_natives_syntax = true; 145 FLAG_allow_natives_syntax = true;
156 FunctionTester T("(function(a) { return %_IsSpecObject(a); })"); 146 FunctionTester T("(function(a) { return %_IsSpecObject(a); })");
157 147
158 T.CheckCall(T.false_value(), T.Val(23), T.undefined()); 148 T.CheckCall(T.false_value(), T.Val(23), T.undefined());
159 T.CheckCall(T.false_value(), T.Val(4.2), T.undefined()); 149 T.CheckCall(T.false_value(), T.Val(4.2), T.undefined());
160 T.CheckCall(T.false_value(), T.Val("str"), T.undefined()); 150 T.CheckCall(T.false_value(), T.Val("str"), T.undefined());
161 T.CheckCall(T.false_value(), T.true_value(), T.undefined()); 151 T.CheckCall(T.false_value(), T.true_value(), T.undefined());
162 T.CheckCall(T.false_value(), T.false_value(), T.undefined()); 152 T.CheckCall(T.false_value(), T.false_value(), T.undefined());
163 T.CheckCall(T.false_value(), T.undefined(), T.undefined()); 153 T.CheckCall(T.false_value(), T.undefined(), T.undefined());
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 v8::Context::Scope scope(context); 234 v8::Context::Scope scope(context);
245 v8::Local<v8::Value> value = CompileRun(script); 235 v8::Local<v8::Value> value = CompileRun(script);
246 i::Handle<i::Object> ofun = v8::Utils::OpenHandle(*value); 236 i::Handle<i::Object> ofun = v8::Utils::OpenHandle(*value);
247 i::Handle<i::JSFunction> jsfun = Handle<JSFunction>::cast(ofun); 237 i::Handle<i::JSFunction> jsfun = Handle<JSFunction>::cast(ofun);
248 jsfun->set_code(T.function->code()); 238 jsfun->set_code(T.function->code());
249 jsfun->set_shared(T.function->shared()); 239 jsfun->set_shared(T.function->shared());
250 context->Global()->Set(v8_str("foo"), v8::Utils::ToLocal(jsfun)); 240 context->Global()->Set(v8_str("foo"), v8::Utils::ToLocal(jsfun));
251 CompileRun("var x = 24;"); 241 CompileRun("var x = 24;");
252 ExpectObject("foo()", context->Global()); 242 ExpectObject("foo()", context->Global());
253 } 243 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698