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

Side by Side Diff: src/hydrogen.cc

Issue 15735005: Collect type feedback for power-of-2 right operands in BinaryOps. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: ARM INT32 stub Created 7 years, 6 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 9333 matching lines...) Expand 10 before | Expand all | Expand 10 after
9344 9344
9345 9345
9346 HInstruction* HOptimizedGraphBuilder::BuildBinaryOperation( 9346 HInstruction* HOptimizedGraphBuilder::BuildBinaryOperation(
9347 BinaryOperation* expr, 9347 BinaryOperation* expr,
9348 HValue* left, 9348 HValue* left,
9349 HValue* right) { 9349 HValue* right) {
9350 HValue* context = environment()->LookupContext(); 9350 HValue* context = environment()->LookupContext();
9351 TypeInfo left_info = expr->left_type(); 9351 TypeInfo left_info = expr->left_type();
9352 TypeInfo right_info = expr->right_type(); 9352 TypeInfo right_info = expr->right_type();
9353 TypeInfo result_info = expr->result_type(); 9353 TypeInfo result_info = expr->result_type();
9354 TypeInfo combined_info; 9354 bool has_fixed_right_arg = expr->has_fixed_right_arg();
9355 int fixed_right_arg_value = expr->fixed_right_arg_value();
9355 Representation left_rep = ToRepresentation(left_info); 9356 Representation left_rep = ToRepresentation(left_info);
9356 Representation right_rep = ToRepresentation(right_info); 9357 Representation right_rep = ToRepresentation(right_info);
9357 Representation result_rep = ToRepresentation(result_info); 9358 Representation result_rep = ToRepresentation(result_info);
9358 if (left_info.IsUninitialized()) { 9359 if (left_info.IsUninitialized()) {
9359 // Can't have initialized one but not the other. 9360 // Can't have initialized one but not the other.
9360 ASSERT(right_info.IsUninitialized()); 9361 ASSERT(right_info.IsUninitialized());
9361 AddSoftDeoptimize(); 9362 AddSoftDeoptimize();
9362 left_info = right_info = TypeInfo::Unknown(); 9363 left_info = right_info = TypeInfo::Unknown();
9363 } 9364 }
9364 HInstruction* instr = NULL; 9365 HInstruction* instr = NULL;
9365 switch (expr->op()) { 9366 switch (expr->op()) {
9366 case Token::ADD: 9367 case Token::ADD:
9367 if (left_info.IsString() && right_info.IsString()) { 9368 if (left_info.IsString() && right_info.IsString()) {
9368 BuildCheckNonSmi(left); 9369 BuildCheckNonSmi(left);
9369 AddInstruction(HCheckInstanceType::NewIsString(left, zone())); 9370 AddInstruction(HCheckInstanceType::NewIsString(left, zone()));
9370 BuildCheckNonSmi(right); 9371 BuildCheckNonSmi(right);
9371 AddInstruction(HCheckInstanceType::NewIsString(right, zone())); 9372 AddInstruction(HCheckInstanceType::NewIsString(right, zone()));
9372 instr = HStringAdd::New(zone(), context, left, right); 9373 instr = HStringAdd::New(zone(), context, left, right);
9373 } else { 9374 } else {
9374 instr = HAdd::New(zone(), context, left, right); 9375 instr = HAdd::New(zone(), context, left, right);
9375 } 9376 }
9376 break; 9377 break;
9377 case Token::SUB: 9378 case Token::SUB:
9378 instr = HSub::New(zone(), context, left, right); 9379 instr = HSub::New(zone(), context, left, right);
9379 break; 9380 break;
9380 case Token::MUL: 9381 case Token::MUL:
9381 instr = HMul::New(zone(), context, left, right); 9382 instr = HMul::New(zone(), context, left, right);
9382 break; 9383 break;
9383 case Token::MOD: 9384 case Token::MOD:
9384 instr = HMod::New(zone(), context, left, right); 9385 instr = HMod::New(zone(),
9386 context,
9387 left,
9388 right,
9389 has_fixed_right_arg,
9390 fixed_right_arg_value);
9385 break; 9391 break;
9386 case Token::DIV: 9392 case Token::DIV:
9387 instr = HDiv::New(zone(), context, left, right); 9393 instr = HDiv::New(zone(), context, left, right);
9388 break; 9394 break;
9389 case Token::BIT_XOR: 9395 case Token::BIT_XOR:
9390 case Token::BIT_AND: 9396 case Token::BIT_AND:
9391 instr = HBitwise::New(zone(), expr->op(), context, left, right); 9397 instr = HBitwise::New(zone(), expr->op(), context, left, right);
9392 break; 9398 break;
9393 case Token::BIT_OR: { 9399 case Token::BIT_OR: {
9394 HValue* operand, *shift_amount; 9400 HValue* operand, *shift_amount;
(...skipping 2103 matching lines...) Expand 10 before | Expand all | Expand 10 after
11498 } 11504 }
11499 } 11505 }
11500 11506
11501 #ifdef DEBUG 11507 #ifdef DEBUG
11502 if (graph_ != NULL) graph_->Verify(false); // No full verify. 11508 if (graph_ != NULL) graph_->Verify(false); // No full verify.
11503 if (allocator_ != NULL) allocator_->Verify(); 11509 if (allocator_ != NULL) allocator_->Verify();
11504 #endif 11510 #endif
11505 } 11511 }
11506 11512
11507 } } // namespace v8::internal 11513 } } // namespace v8::internal
OLDNEW
« src/code-stubs.h ('K') | « src/deoptimizer.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698