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 9316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9327 | 9327 |
9328 | 9328 |
9329 HInstruction* HOptimizedGraphBuilder::BuildBinaryOperation( | 9329 HInstruction* HOptimizedGraphBuilder::BuildBinaryOperation( |
9330 BinaryOperation* expr, | 9330 BinaryOperation* expr, |
9331 HValue* left, | 9331 HValue* left, |
9332 HValue* right) { | 9332 HValue* right) { |
9333 HValue* context = environment()->LookupContext(); | 9333 HValue* context = environment()->LookupContext(); |
9334 TypeInfo left_info = expr->left_type(); | 9334 TypeInfo left_info = expr->left_type(); |
9335 TypeInfo right_info = expr->right_type(); | 9335 TypeInfo right_info = expr->right_type(); |
9336 TypeInfo result_info = expr->result_type(); | 9336 TypeInfo result_info = expr->result_type(); |
9337 TypeInfo combined_info; | 9337 bool has_fixed_right_arg = expr->has_fixed_right_arg(); |
| 9338 int fixed_right_arg_value = expr->fixed_right_arg_value(); |
9338 Representation left_rep = ToRepresentation(left_info); | 9339 Representation left_rep = ToRepresentation(left_info); |
9339 Representation right_rep = ToRepresentation(right_info); | 9340 Representation right_rep = ToRepresentation(right_info); |
9340 Representation result_rep = ToRepresentation(result_info); | 9341 Representation result_rep = ToRepresentation(result_info); |
9341 if (left_info.IsUninitialized()) { | 9342 if (left_info.IsUninitialized()) { |
9342 // Can't have initialized one but not the other. | 9343 // Can't have initialized one but not the other. |
9343 ASSERT(right_info.IsUninitialized()); | 9344 ASSERT(right_info.IsUninitialized()); |
9344 AddSoftDeoptimize(); | 9345 AddSoftDeoptimize(); |
9345 left_info = right_info = TypeInfo::Unknown(); | 9346 left_info = right_info = TypeInfo::Unknown(); |
9346 } | 9347 } |
9347 HInstruction* instr = NULL; | 9348 HInstruction* instr = NULL; |
9348 switch (expr->op()) { | 9349 switch (expr->op()) { |
9349 case Token::ADD: | 9350 case Token::ADD: |
9350 if (left_info.IsString() && right_info.IsString()) { | 9351 if (left_info.IsString() && right_info.IsString()) { |
9351 BuildCheckNonSmi(left); | 9352 BuildCheckNonSmi(left); |
9352 AddInstruction(HCheckInstanceType::NewIsString(left, zone())); | 9353 AddInstruction(HCheckInstanceType::NewIsString(left, zone())); |
9353 BuildCheckNonSmi(right); | 9354 BuildCheckNonSmi(right); |
9354 AddInstruction(HCheckInstanceType::NewIsString(right, zone())); | 9355 AddInstruction(HCheckInstanceType::NewIsString(right, zone())); |
9355 instr = HStringAdd::New(zone(), context, left, right); | 9356 instr = HStringAdd::New(zone(), context, left, right); |
9356 } else { | 9357 } else { |
9357 instr = HAdd::New(zone(), context, left, right); | 9358 instr = HAdd::New(zone(), context, left, right); |
9358 } | 9359 } |
9359 break; | 9360 break; |
9360 case Token::SUB: | 9361 case Token::SUB: |
9361 instr = HSub::New(zone(), context, left, right); | 9362 instr = HSub::New(zone(), context, left, right); |
9362 break; | 9363 break; |
9363 case Token::MUL: | 9364 case Token::MUL: |
9364 instr = HMul::New(zone(), context, left, right); | 9365 instr = HMul::New(zone(), context, left, right); |
9365 break; | 9366 break; |
9366 case Token::MOD: | 9367 case Token::MOD: |
9367 instr = HMod::New(zone(), context, left, right); | 9368 instr = HMod::New(zone(), |
| 9369 context, |
| 9370 left, |
| 9371 right, |
| 9372 has_fixed_right_arg, |
| 9373 fixed_right_arg_value); |
9368 break; | 9374 break; |
9369 case Token::DIV: | 9375 case Token::DIV: |
9370 instr = HDiv::New(zone(), context, left, right); | 9376 instr = HDiv::New(zone(), context, left, right); |
9371 break; | 9377 break; |
9372 case Token::BIT_XOR: | 9378 case Token::BIT_XOR: |
9373 case Token::BIT_AND: | 9379 case Token::BIT_AND: |
9374 instr = HBitwise::New(zone(), expr->op(), context, left, right); | 9380 instr = HBitwise::New(zone(), expr->op(), context, left, right); |
9375 break; | 9381 break; |
9376 case Token::BIT_OR: { | 9382 case Token::BIT_OR: { |
9377 HValue* operand, *shift_amount; | 9383 HValue* operand, *shift_amount; |
(...skipping 2103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11481 } | 11487 } |
11482 } | 11488 } |
11483 | 11489 |
11484 #ifdef DEBUG | 11490 #ifdef DEBUG |
11485 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 11491 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
11486 if (allocator_ != NULL) allocator_->Verify(); | 11492 if (allocator_ != NULL) allocator_->Verify(); |
11487 #endif | 11493 #endif |
11488 } | 11494 } |
11489 | 11495 |
11490 } } // namespace v8::internal | 11496 } } // namespace v8::internal |
OLD | NEW |