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

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

Issue 1123353004: Revert of Wrap runtime.js in a function. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « src/v8natives.js ('k') | test/mjsunit/samevalue.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 FunctionTester T("(function(a,b) { return %NumberAdd(a, b); })"); 151 FunctionTester T("(function(a,b) { return %NumberAdd(a, b); })");
152 152
153 T.CheckCall(T.Val(65), T.Val(42), T.Val(23)); 153 T.CheckCall(T.Val(65), T.Val(42), T.Val(23));
154 T.CheckCall(T.Val(19), T.Val(42), T.Val(-23)); 154 T.CheckCall(T.Val(19), T.Val(42), T.Val(-23));
155 T.CheckCall(T.Val(6.5), T.Val(4.2), T.Val(2.3)); 155 T.CheckCall(T.Val(6.5), T.Val(4.2), T.Val(2.3));
156 } 156 }
157 157
158 158
159 TEST(RuntimeCallJS) { 159 TEST(RuntimeCallJS) {
160 FLAG_allow_natives_syntax = true; 160 FLAG_allow_natives_syntax = true;
161 FunctionTester T("(function(a) { return %$toString(a); })"); 161 FunctionTester T("(function(a) { return %ToString(a); })");
162 162
163 T.CheckCall(T.Val("23"), T.Val(23), T.undefined()); 163 T.CheckCall(T.Val("23"), T.Val(23), T.undefined());
164 T.CheckCall(T.Val("4.2"), T.Val(4.2), T.undefined()); 164 T.CheckCall(T.Val("4.2"), T.Val(4.2), T.undefined());
165 T.CheckCall(T.Val("str"), T.Val("str"), T.undefined()); 165 T.CheckCall(T.Val("str"), T.Val("str"), T.undefined());
166 T.CheckCall(T.Val("true"), T.true_value(), T.undefined()); 166 T.CheckCall(T.Val("true"), T.true_value(), T.undefined());
167 T.CheckCall(T.Val("false"), T.false_value(), T.undefined()); 167 T.CheckCall(T.Val("false"), T.false_value(), T.undefined());
168 T.CheckCall(T.Val("undefined"), T.undefined(), T.undefined()); 168 T.CheckCall(T.Val("undefined"), T.undefined(), T.undefined());
169 } 169 }
170 170
171 171
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 v8::Local<v8::Context> context = v8::Context::New(CcTest::isolate()); 260 v8::Local<v8::Context> context = v8::Context::New(CcTest::isolate());
261 v8::Context::Scope scope(context); 261 v8::Context::Scope scope(context);
262 v8::Local<v8::Value> value = CompileRun(script); 262 v8::Local<v8::Value> value = CompileRun(script);
263 i::Handle<i::Object> ofun = v8::Utils::OpenHandle(*value); 263 i::Handle<i::Object> ofun = v8::Utils::OpenHandle(*value);
264 i::Handle<i::JSFunction> jsfun = Handle<JSFunction>::cast(ofun); 264 i::Handle<i::JSFunction> jsfun = Handle<JSFunction>::cast(ofun);
265 jsfun->set_code(T.function->code()); 265 jsfun->set_code(T.function->code());
266 context->Global()->Set(v8_str("foo"), v8::Utils::ToLocal(jsfun)); 266 context->Global()->Set(v8_str("foo"), v8::Utils::ToLocal(jsfun));
267 CompileRun("var x = 24;"); 267 CompileRun("var x = 24;");
268 ExpectObject("foo()", context->Global()); 268 ExpectObject("foo()", context->Global());
269 } 269 }
OLDNEW
« no previous file with comments | « src/v8natives.js ('k') | test/mjsunit/samevalue.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698