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

Side by Side Diff: test/cctest/compiler/test-js-typed-lowering.cc

Issue 584573003: Add JSBuiltinReducer for inlining well-known builtins. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Ben Titzer. Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/compiler/js-typed-lowering.cc ('k') | tools/gyp/v8.gyp » ('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 #include "test/cctest/cctest.h" 6 #include "test/cctest/cctest.h"
7 7
8 #include "src/compiler/graph-inl.h" 8 #include "src/compiler/graph-inl.h"
9 #include "src/compiler/js-typed-lowering.h" 9 #include "src/compiler/js-typed-lowering.h"
10 #include "src/compiler/node-properties-inl.h" 10 #include "src/compiler/node-properties-inl.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 NodeProperties::SetBounds(n, Bounds(Type::None(), t)); 47 NodeProperties::SetBounds(n, Bounds(Type::None(), t));
48 return n; 48 return n;
49 } 49 }
50 50
51 Node* UndefinedConstant() { 51 Node* UndefinedConstant() {
52 Unique<Object> unique = 52 Unique<Object> unique =
53 Unique<Object>::CreateImmovable(isolate->factory()->undefined_value()); 53 Unique<Object>::CreateImmovable(isolate->factory()->undefined_value());
54 return graph.NewNode(common.HeapConstant(unique)); 54 return graph.NewNode(common.HeapConstant(unique));
55 } 55 }
56 56
57 Node* HeapConstant(Handle<Object> constant) {
58 Unique<Object> unique = Unique<Object>::CreateUninitialized(constant);
59 return graph.NewNode(common.HeapConstant(unique));
60 }
61
57 Node* EmptyFrameState(Node* context) { 62 Node* EmptyFrameState(Node* context) {
58 Node* parameters = graph.NewNode(common.StateValues(0)); 63 Node* parameters = graph.NewNode(common.StateValues(0));
59 Node* locals = graph.NewNode(common.StateValues(0)); 64 Node* locals = graph.NewNode(common.StateValues(0));
60 Node* stack = graph.NewNode(common.StateValues(0)); 65 Node* stack = graph.NewNode(common.StateValues(0));
61 66
62 Node* state_node = 67 Node* state_node =
63 graph.NewNode(common.FrameState(JS_FRAME, BailoutId(0), kIgnoreOutput), 68 graph.NewNode(common.FrameState(JS_FRAME, BailoutId(0), kIgnoreOutput),
64 parameters, locals, stack, context, UndefinedConstant()); 69 parameters, locals, stack, context, UndefinedConstant());
65 70
66 return state_node; 71 return state_node;
(...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after
1371 CHECK_EQ(p1, r->InputAt(0)); 1376 CHECK_EQ(p1, r->InputAt(0));
1372 CHECK_EQ(p0, r->InputAt(1)); 1377 CHECK_EQ(p0, r->InputAt(1));
1373 } else { 1378 } else {
1374 CHECK_EQ(p0, r->InputAt(0)); 1379 CHECK_EQ(p0, r->InputAt(0));
1375 CHECK_EQ(p1, r->InputAt(1)); 1380 CHECK_EQ(p1, r->InputAt(1));
1376 } 1381 }
1377 } 1382 }
1378 } 1383 }
1379 } 1384 }
1380 } 1385 }
1386
1387
1388 TEST(BuiltinMathImul) {
1389 JSTypedLoweringTester R;
1390
1391 for (size_t i = 0; i < arraysize(kNumberTypes); i++) {
1392 for (size_t j = 0; j < arraysize(kNumberTypes); j++) {
1393 Type* t0 = kNumberTypes[i];
1394 Node* p0 = R.Parameter(t0, 0);
1395 Type* t1 = kNumberTypes[j];
1396 Node* p1 = R.Parameter(t1, 1);
1397 Node* fun = R.HeapConstant(handle(R.isolate->context()->math_imul_fun()));
1398 Node* call = R.graph.NewNode(R.javascript.Call(4, NO_CALL_FUNCTION_FLAGS),
1399 fun, R.UndefinedConstant(), p0, p1);
1400 Node* r = R.reduce(call);
1401
1402 if (t0->Is(Type::Integral32()) && t1->Is(Type::Integral32())) {
1403 R.CheckPureBinop(R.machine.Int32Mul(), r);
1404 CHECK_EQ(p0, r->InputAt(0));
1405 CHECK_EQ(p1, r->InputAt(1));
1406 } else {
1407 CHECK_EQ(IrOpcode::kJSCallFunction, r->opcode());
1408 CHECK_EQ(call, r);
1409 }
1410 }
1411 }
1412 }
OLDNEW
« no previous file with comments | « src/compiler/js-typed-lowering.cc ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698