OLD | NEW |
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 9343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9354 | 9354 |
9355 | 9355 |
9356 HInstruction* HOptimizedGraphBuilder::BuildBinaryOperation( | 9356 HInstruction* HOptimizedGraphBuilder::BuildBinaryOperation( |
9357 BinaryOperation* expr, | 9357 BinaryOperation* expr, |
9358 HValue* left, | 9358 HValue* left, |
9359 HValue* right) { | 9359 HValue* right) { |
9360 HValue* context = environment()->LookupContext(); | 9360 HValue* context = environment()->LookupContext(); |
9361 TypeInfo left_info = expr->left_type(); | 9361 TypeInfo left_info = expr->left_type(); |
9362 TypeInfo right_info = expr->right_type(); | 9362 TypeInfo right_info = expr->right_type(); |
9363 TypeInfo result_info = expr->result_type(); | 9363 TypeInfo result_info = expr->result_type(); |
9364 TypeInfo combined_info; | 9364 bool has_fixed_right_arg = expr->has_fixed_right_arg(); |
| 9365 int fixed_right_arg_value = expr->fixed_right_arg_value(); |
9365 Representation left_rep = ToRepresentation(left_info); | 9366 Representation left_rep = ToRepresentation(left_info); |
9366 Representation right_rep = ToRepresentation(right_info); | 9367 Representation right_rep = ToRepresentation(right_info); |
9367 Representation result_rep = ToRepresentation(result_info); | 9368 Representation result_rep = ToRepresentation(result_info); |
9368 if (left_info.IsUninitialized()) { | 9369 if (left_info.IsUninitialized()) { |
9369 // Can't have initialized one but not the other. | 9370 // Can't have initialized one but not the other. |
9370 ASSERT(right_info.IsUninitialized()); | 9371 ASSERT(right_info.IsUninitialized()); |
9371 AddSoftDeoptimize(); | 9372 AddSoftDeoptimize(); |
9372 left_info = right_info = TypeInfo::Unknown(); | 9373 left_info = right_info = TypeInfo::Unknown(); |
9373 } | 9374 } |
9374 HInstruction* instr = NULL; | 9375 HInstruction* instr = NULL; |
9375 switch (expr->op()) { | 9376 switch (expr->op()) { |
9376 case Token::ADD: | 9377 case Token::ADD: |
9377 if (left_info.IsString() && right_info.IsString()) { | 9378 if (left_info.IsString() && right_info.IsString()) { |
9378 BuildCheckNonSmi(left); | 9379 BuildCheckNonSmi(left); |
9379 AddInstruction(HCheckInstanceType::NewIsString(left, zone())); | 9380 AddInstruction(HCheckInstanceType::NewIsString(left, zone())); |
9380 BuildCheckNonSmi(right); | 9381 BuildCheckNonSmi(right); |
9381 AddInstruction(HCheckInstanceType::NewIsString(right, zone())); | 9382 AddInstruction(HCheckInstanceType::NewIsString(right, zone())); |
9382 instr = HStringAdd::New(zone(), context, left, right); | 9383 instr = HStringAdd::New(zone(), context, left, right); |
9383 } else { | 9384 } else { |
9384 instr = HAdd::New(zone(), context, left, right); | 9385 instr = HAdd::New(zone(), context, left, right); |
9385 } | 9386 } |
9386 break; | 9387 break; |
9387 case Token::SUB: | 9388 case Token::SUB: |
9388 instr = HSub::New(zone(), context, left, right); | 9389 instr = HSub::New(zone(), context, left, right); |
9389 break; | 9390 break; |
9390 case Token::MUL: | 9391 case Token::MUL: |
9391 instr = HMul::New(zone(), context, left, right); | 9392 instr = HMul::New(zone(), context, left, right); |
9392 break; | 9393 break; |
9393 case Token::MOD: | 9394 case Token::MOD: |
9394 instr = HMod::New(zone(), context, left, right); | 9395 instr = HMod::New(zone(), |
| 9396 context, |
| 9397 left, |
| 9398 right, |
| 9399 has_fixed_right_arg, |
| 9400 fixed_right_arg_value); |
9395 break; | 9401 break; |
9396 case Token::DIV: | 9402 case Token::DIV: |
9397 instr = HDiv::New(zone(), context, left, right); | 9403 instr = HDiv::New(zone(), context, left, right); |
9398 break; | 9404 break; |
9399 case Token::BIT_XOR: | 9405 case Token::BIT_XOR: |
9400 case Token::BIT_AND: | 9406 case Token::BIT_AND: |
9401 instr = HBitwise::New(zone(), expr->op(), context, left, right); | 9407 instr = HBitwise::New(zone(), expr->op(), context, left, right); |
9402 break; | 9408 break; |
9403 case Token::BIT_OR: { | 9409 case Token::BIT_OR: { |
9404 HValue* operand, *shift_amount; | 9410 HValue* operand, *shift_amount; |
(...skipping 2062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11467 } | 11473 } |
11468 } | 11474 } |
11469 | 11475 |
11470 #ifdef DEBUG | 11476 #ifdef DEBUG |
11471 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 11477 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
11472 if (allocator_ != NULL) allocator_->Verify(); | 11478 if (allocator_ != NULL) allocator_->Verify(); |
11473 #endif | 11479 #endif |
11474 } | 11480 } |
11475 | 11481 |
11476 } } // namespace v8::internal | 11482 } } // namespace v8::internal |
OLD | NEW |