OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 offset += JavaScriptFrameConstants::kLocal0Offset; | 310 offset += JavaScriptFrameConstants::kLocal0Offset; |
311 break; | 311 break; |
312 case Slot::CONTEXT: | 312 case Slot::CONTEXT: |
313 case Slot::LOOKUP: | 313 case Slot::LOOKUP: |
314 UNREACHABLE(); | 314 UNREACHABLE(); |
315 } | 315 } |
316 return offset; | 316 return offset; |
317 } | 317 } |
318 | 318 |
319 | 319 |
| 320 bool FullCodeGenerator::ShouldInlineSmiCase(Token::Value op) { |
| 321 if (Debugger::IsDebuggerActive()) return false; |
| 322 if (op == Token::DIV ||op == Token::MOD) return false; |
| 323 return loop_depth_ > 0; |
| 324 } |
| 325 |
| 326 |
320 void FullCodeGenerator::PrepareTest(Label* materialize_true, | 327 void FullCodeGenerator::PrepareTest(Label* materialize_true, |
321 Label* materialize_false, | 328 Label* materialize_false, |
322 Label** if_true, | 329 Label** if_true, |
323 Label** if_false, | 330 Label** if_false, |
324 Label** fall_through) { | 331 Label** fall_through) { |
325 switch (context_) { | 332 switch (context_) { |
326 case Expression::kUninitialized: | 333 case Expression::kUninitialized: |
327 UNREACHABLE(); | 334 UNREACHABLE(); |
328 break; | 335 break; |
329 case Expression::kEffect: | 336 case Expression::kEffect: |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 return; \ | 503 return; \ |
497 } | 504 } |
498 INLINE_RUNTIME_FUNCTION_LIST(CHECK_EMIT_INLINE_CALL) | 505 INLINE_RUNTIME_FUNCTION_LIST(CHECK_EMIT_INLINE_CALL) |
499 #undef CHECK_EMIT_INLINE_CALL | 506 #undef CHECK_EMIT_INLINE_CALL |
500 UNREACHABLE(); | 507 UNREACHABLE(); |
501 } | 508 } |
502 | 509 |
503 | 510 |
504 void FullCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) { | 511 void FullCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) { |
505 Comment cmnt(masm_, "[ BinaryOperation"); | 512 Comment cmnt(masm_, "[ BinaryOperation"); |
| 513 |
| 514 OverwriteMode overwrite_mode = NO_OVERWRITE; |
| 515 if (expr->left()->ResultOverwriteAllowed()) { |
| 516 overwrite_mode = OVERWRITE_LEFT; |
| 517 } else if (expr->right()->ResultOverwriteAllowed()) { |
| 518 overwrite_mode = OVERWRITE_RIGHT; |
| 519 } |
| 520 |
506 switch (expr->op()) { | 521 switch (expr->op()) { |
507 case Token::COMMA: | 522 case Token::COMMA: |
508 VisitForEffect(expr->left()); | 523 VisitForEffect(expr->left()); |
509 Visit(expr->right()); | 524 Visit(expr->right()); |
510 break; | 525 break; |
511 | 526 |
512 case Token::OR: | 527 case Token::OR: |
513 case Token::AND: | 528 case Token::AND: |
514 EmitLogicalOperation(expr); | 529 EmitLogicalOperation(expr); |
515 break; | 530 break; |
516 | 531 |
517 case Token::ADD: | 532 case Token::ADD: |
518 case Token::SUB: | 533 case Token::SUB: |
519 case Token::DIV: | 534 case Token::DIV: |
520 case Token::MOD: | 535 case Token::MOD: |
521 case Token::MUL: | 536 case Token::MUL: |
522 case Token::BIT_OR: | 537 case Token::BIT_OR: |
523 case Token::BIT_AND: | 538 case Token::BIT_AND: |
524 case Token::BIT_XOR: | 539 case Token::BIT_XOR: |
525 case Token::SHL: | 540 case Token::SHL: |
526 case Token::SHR: | 541 case Token::SHR: |
527 case Token::SAR: | 542 case Token::SAR: |
528 VisitForValue(expr->left(), kStack); | 543 VisitForValue(expr->left(), kStack); |
529 VisitForValue(expr->right(), kAccumulator); | 544 VisitForValue(expr->right(), kAccumulator); |
530 SetSourcePosition(expr->position()); | 545 SetSourcePosition(expr->position()); |
531 EmitBinaryOp(expr->op(), context_); | 546 EmitBinaryOp(expr->op(), context_, overwrite_mode); |
532 break; | 547 break; |
533 | 548 |
534 default: | 549 default: |
535 UNREACHABLE(); | 550 UNREACHABLE(); |
536 } | 551 } |
537 } | 552 } |
538 | 553 |
539 | 554 |
540 void FullCodeGenerator::EmitLogicalOperation(BinaryOperation* expr) { | 555 void FullCodeGenerator::EmitLogicalOperation(BinaryOperation* expr) { |
541 Label eval_right, done; | 556 Label eval_right, done; |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1086 ASSERT(args->length() == 1); | 1101 ASSERT(args->length() == 1); |
1087 VisitForValue(args->at(0), kStack); | 1102 VisitForValue(args->at(0), kStack); |
1088 __ CallRuntime(Runtime::kRegExpCloneResult, 1); | 1103 __ CallRuntime(Runtime::kRegExpCloneResult, 1); |
1089 Apply(context_, result_register()); | 1104 Apply(context_, result_register()); |
1090 } | 1105 } |
1091 | 1106 |
1092 #undef __ | 1107 #undef __ |
1093 | 1108 |
1094 | 1109 |
1095 } } // namespace v8::internal | 1110 } } // namespace v8::internal |
OLD | NEW |