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

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

Issue 933913002: Fix representation for CompareIC in JSGenericLowering. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Smash bounds and workaround. Created 5 years, 10 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/runtime/runtime-object.cc ('k') | test/cctest/compiler/test-run-jsops.cc » ('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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 T.CheckCall(T.false_value(), T.Val(4.2), T.undefined()); 177 T.CheckCall(T.false_value(), T.Val(4.2), T.undefined());
178 T.CheckCall(T.false_value(), T.Val("str"), T.undefined()); 178 T.CheckCall(T.false_value(), T.Val("str"), T.undefined());
179 T.CheckCall(T.false_value(), T.true_value(), T.undefined()); 179 T.CheckCall(T.false_value(), T.true_value(), T.undefined());
180 T.CheckCall(T.false_value(), T.false_value(), T.undefined()); 180 T.CheckCall(T.false_value(), T.false_value(), T.undefined());
181 T.CheckCall(T.false_value(), T.undefined(), T.undefined()); 181 T.CheckCall(T.false_value(), T.undefined(), T.undefined());
182 T.CheckCall(T.true_value(), T.NewObject("({})"), T.undefined()); 182 T.CheckCall(T.true_value(), T.NewObject("({})"), T.undefined());
183 T.CheckCall(T.true_value(), T.NewObject("([])"), T.undefined()); 183 T.CheckCall(T.true_value(), T.NewObject("([])"), T.undefined());
184 } 184 }
185 185
186 186
187 TEST(RuntimeCallBooleanize) {
188 // TODO(turbofan): %Booleanize will disappear, don't hesitate to remove this
189 // test case, two-argument case is covered by the above test already.
190 FLAG_allow_natives_syntax = true;
191 FunctionTester T("(function(a,b) { return %Booleanize(a, b); })");
192
193 T.CheckCall(T.true_value(), T.Val(-1), T.Val(Token::LT));
194 T.CheckCall(T.false_value(), T.Val(-1), T.Val(Token::EQ));
195 T.CheckCall(T.false_value(), T.Val(-1), T.Val(Token::GT));
196
197 T.CheckCall(T.false_value(), T.Val(0.0), T.Val(Token::LT));
198 T.CheckCall(T.true_value(), T.Val(0.0), T.Val(Token::EQ));
199 T.CheckCall(T.false_value(), T.Val(0.0), T.Val(Token::GT));
200
201 T.CheckCall(T.false_value(), T.Val(1), T.Val(Token::LT));
202 T.CheckCall(T.false_value(), T.Val(1), T.Val(Token::EQ));
203 T.CheckCall(T.true_value(), T.Val(1), T.Val(Token::GT));
204 }
205
206
207 TEST(EvalCall) { 187 TEST(EvalCall) {
208 FunctionTester T("(function(a,b) { return eval(a); })"); 188 FunctionTester T("(function(a,b) { return eval(a); })");
209 Handle<JSObject> g(T.function->context()->global_object()->global_proxy()); 189 Handle<JSObject> g(T.function->context()->global_object()->global_proxy());
210 190
211 T.CheckCall(T.Val(23), T.Val("17 + 6"), T.undefined()); 191 T.CheckCall(T.Val(23), T.Val("17 + 6"), T.undefined());
212 T.CheckCall(T.Val("'Y'; a"), T.Val("'Y'; a"), T.Val("b-val")); 192 T.CheckCall(T.Val("'Y'; a"), T.Val("'Y'; a"), T.Val("b-val"));
213 T.CheckCall(T.Val("b-val"), T.Val("'Y'; b"), T.Val("b-val")); 193 T.CheckCall(T.Val("b-val"), T.Val("'Y'; b"), T.Val("b-val"));
214 T.CheckCall(g, T.Val("this"), T.undefined()); 194 T.CheckCall(g, T.Val("this"), T.undefined());
215 T.CheckCall(g, T.Val("'use strict'; this"), T.undefined()); 195 T.CheckCall(g, T.Val("'use strict'; this"), T.undefined());
216 196
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 v8::Local<v8::Context> context = v8::Context::New(CcTest::isolate()); 260 v8::Local<v8::Context> context = v8::Context::New(CcTest::isolate());
281 v8::Context::Scope scope(context); 261 v8::Context::Scope scope(context);
282 v8::Local<v8::Value> value = CompileRun(script); 262 v8::Local<v8::Value> value = CompileRun(script);
283 i::Handle<i::Object> ofun = v8::Utils::OpenHandle(*value); 263 i::Handle<i::Object> ofun = v8::Utils::OpenHandle(*value);
284 i::Handle<i::JSFunction> jsfun = Handle<JSFunction>::cast(ofun); 264 i::Handle<i::JSFunction> jsfun = Handle<JSFunction>::cast(ofun);
285 jsfun->set_code(T.function->code()); 265 jsfun->set_code(T.function->code());
286 context->Global()->Set(v8_str("foo"), v8::Utils::ToLocal(jsfun)); 266 context->Global()->Set(v8_str("foo"), v8::Utils::ToLocal(jsfun));
287 CompileRun("var x = 24;"); 267 CompileRun("var x = 24;");
288 ExpectObject("foo()", context->Global()); 268 ExpectObject("foo()", context->Global());
289 } 269 }
OLDNEW
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | test/cctest/compiler/test-run-jsops.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698