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

Side by Side Diff: src/crankshaft/hydrogen.cc

Issue 1884103002: [crankshaft] Hook the binary operators TurboFan code stubs with crankshaft. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Update Created 4 years, 8 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/crankshaft/hydrogen.h" 5 #include "src/crankshaft/hydrogen.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/allocation-site-scopes.h" 9 #include "src/allocation-site-scopes.h"
10 #include "src/ast/ast-numbering.h" 10 #include "src/ast/ast-numbering.h"
(...skipping 11272 matching lines...) Expand 10 before | Expand all | Expand 10 after
11283 Representation result_rep = RepresentationFor(result_type); 11283 Representation result_rep = RepresentationFor(result_type);
11284 11284
11285 bool is_non_primitive = (left_rep.IsTagged() && !left_rep.IsSmi()) || 11285 bool is_non_primitive = (left_rep.IsTagged() && !left_rep.IsSmi()) ||
11286 (right_rep.IsTagged() && !right_rep.IsSmi()); 11286 (right_rep.IsTagged() && !right_rep.IsSmi());
11287 11287
11288 HInstruction* instr = NULL; 11288 HInstruction* instr = NULL;
11289 // Only the stub is allowed to call into the runtime, since otherwise we would 11289 // Only the stub is allowed to call into the runtime, since otherwise we would
11290 // inline several instructions (including the two pushes) for every tagged 11290 // inline several instructions (including the two pushes) for every tagged
11291 // operation in optimized code, which is more expensive, than a stub call. 11291 // operation in optimized code, which is more expensive, than a stub call.
11292 if (graph()->info()->IsStub() && is_non_primitive) { 11292 if (graph()->info()->IsStub() && is_non_primitive) {
11293 Runtime::FunctionId function_id; 11293 HValue* values[] = {context(), left, right};
11294 #define GET_STUB(Name) \
11295 do { \
11296 Callable callable = CodeFactory::Name(isolate()); \
11297 HValue* stub = Add<HConstant>(callable.code()); \
11298 instr = AddUncasted<HCallWithDescriptor>( \
11299 stub, 0, callable.descriptor(), \
11300 Vector<HValue*>(values, arraysize(values))); \
11301 } while (false)
11302
11294 switch (op) { 11303 switch (op) {
11295 default: 11304 default:
11296 UNREACHABLE(); 11305 UNREACHABLE();
11297 case Token::ADD: 11306 case Token::ADD:
11298 function_id = Runtime::kAdd; 11307 GET_STUB(Add);
11299 break; 11308 break;
11300 case Token::SUB: 11309 case Token::SUB:
11301 function_id = Runtime::kSubtract; 11310 GET_STUB(Subtract);
11302 break; 11311 break;
11303 case Token::MUL: 11312 case Token::MUL:
11304 function_id = Runtime::kMultiply; 11313 GET_STUB(Multiply);
11305 break; 11314 break;
11306 case Token::DIV: 11315 case Token::DIV:
11307 function_id = Runtime::kDivide; 11316 GET_STUB(Divide);
11308 break; 11317 break;
11309 case Token::MOD: 11318 case Token::MOD:
11310 function_id = Runtime::kModulus; 11319 GET_STUB(Modulus);
11311 break; 11320 break;
11312 case Token::BIT_OR: 11321 case Token::BIT_OR:
11313 function_id = Runtime::kBitwiseOr; 11322 GET_STUB(BitwiseOr);
11314 break; 11323 break;
11315 case Token::BIT_AND: 11324 case Token::BIT_AND:
11316 function_id = Runtime::kBitwiseAnd; 11325 GET_STUB(BitwiseAnd);
11317 break; 11326 break;
11318 case Token::BIT_XOR: 11327 case Token::BIT_XOR:
11319 function_id = Runtime::kBitwiseXor; 11328 GET_STUB(BitwiseXor);
11320 break; 11329 break;
11321 case Token::SAR: 11330 case Token::SAR:
11322 function_id = Runtime::kShiftRight; 11331 GET_STUB(ShiftRight);
11323 break; 11332 break;
11324 case Token::SHR: 11333 case Token::SHR:
11325 function_id = Runtime::kShiftRightLogical; 11334 GET_STUB(ShiftRightLogical);
11326 break; 11335 break;
11327 case Token::SHL: 11336 case Token::SHL:
11328 function_id = Runtime::kShiftLeft; 11337 GET_STUB(ShiftLeft);
11329 break; 11338 break;
11330 } 11339 }
11331 Add<HPushArguments>(left, right); 11340 #undef GET_STUB
11332 instr = AddUncasted<HCallRuntime>(Runtime::FunctionForId(function_id), 2);
11333 } else { 11341 } else {
11334 switch (op) { 11342 switch (op) {
11335 case Token::ADD: 11343 case Token::ADD:
11336 instr = AddUncasted<HAdd>(left, right); 11344 instr = AddUncasted<HAdd>(left, right);
11337 break; 11345 break;
11338 case Token::SUB: 11346 case Token::SUB:
11339 instr = AddUncasted<HSub>(left, right); 11347 instr = AddUncasted<HSub>(left, right);
11340 break; 11348 break;
11341 case Token::MUL: 11349 case Token::MUL:
11342 instr = AddUncasted<HMul>(left, right); 11350 instr = AddUncasted<HMul>(left, right);
(...skipping 2363 matching lines...) Expand 10 before | Expand all | Expand 10 after
13706 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13714 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13707 } 13715 }
13708 13716
13709 #ifdef DEBUG 13717 #ifdef DEBUG
13710 graph_->Verify(false); // No full verify. 13718 graph_->Verify(false); // No full verify.
13711 #endif 13719 #endif
13712 } 13720 }
13713 13721
13714 } // namespace internal 13722 } // namespace internal
13715 } // namespace v8 13723 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698