| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 | 564 |
| 565 private: | 565 private: |
| 566 Major MajorKey() { return ToBoolean; } | 566 Major MajorKey() { return ToBoolean; } |
| 567 int MinorKey() { return 0; } | 567 int MinorKey() { return 0; } |
| 568 }; | 568 }; |
| 569 | 569 |
| 570 | 570 |
| 571 // ECMA-262, section 9.2, page 30: ToBoolean(). Pop the top of stack and | 571 // ECMA-262, section 9.2, page 30: ToBoolean(). Pop the top of stack and |
| 572 // convert it to a boolean in the condition code register or jump to | 572 // convert it to a boolean in the condition code register or jump to |
| 573 // 'false_target'/'true_target' as appropriate. | 573 // 'false_target'/'true_target' as appropriate. |
| 574 void CodeGenerator::ToBoolean(JumpTarget* true_target, JumpTarget* false_target)
{ | 574 void CodeGenerator::ToBoolean(JumpTarget* true_target, |
| 575 JumpTarget* false_target) { |
| 575 Comment cmnt(masm_, "[ ToBoolean"); | 576 Comment cmnt(masm_, "[ ToBoolean"); |
| 576 | 577 |
| 577 // The value to convert should be popped from the stack. | 578 // The value to convert should be popped from the stack. |
| 578 frame_->EmitPop(eax); | 579 frame_->EmitPop(eax); |
| 579 | 580 |
| 580 // Fast case checks. | 581 // Fast case checks. |
| 581 | 582 |
| 582 // 'false' => false. | 583 // 'false' => false. |
| 583 __ cmp(eax, Factory::false_value()); | 584 __ cmp(eax, Factory::false_value()); |
| 584 false_target->Branch(equal); | 585 false_target->Branch(equal); |
| (...skipping 3475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4060 __ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset)); | 4061 __ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset)); |
| 4061 __ cmp(ecx, FIRST_JS_OBJECT_TYPE); | 4062 __ cmp(ecx, FIRST_JS_OBJECT_TYPE); |
| 4062 false_target()->Branch(less); | 4063 false_target()->Branch(less); |
| 4063 __ cmp(ecx, LAST_JS_OBJECT_TYPE); | 4064 __ cmp(ecx, LAST_JS_OBJECT_TYPE); |
| 4064 cc_reg_ = less_equal; | 4065 cc_reg_ = less_equal; |
| 4065 | 4066 |
| 4066 } else { | 4067 } else { |
| 4067 // Uncommon case: typeof testing against a string literal that is | 4068 // Uncommon case: typeof testing against a string literal that is |
| 4068 // never returned from the typeof operator. | 4069 // never returned from the typeof operator. |
| 4069 false_target()->Jump(); | 4070 false_target()->Jump(); |
| 4070 // TODO(): Can this cause a problem because it is an expression that | 4071 // TODO(kmilliken) : Can this cause a problem because it is an expression |
| 4071 // exits without a virtual frame in place? | 4072 // that exits without a virtual frame in place? |
| 4072 } | 4073 } |
| 4073 return; | 4074 return; |
| 4074 } | 4075 } |
| 4075 | 4076 |
| 4076 Condition cc = no_condition; | 4077 Condition cc = no_condition; |
| 4077 bool strict = false; | 4078 bool strict = false; |
| 4078 switch (op) { | 4079 switch (op) { |
| 4079 case Token::EQ_STRICT: | 4080 case Token::EQ_STRICT: |
| 4080 strict = true; | 4081 strict = true; |
| 4081 // Fall through | 4082 // Fall through |
| (...skipping 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5663 | 5664 |
| 5664 // Slow-case: Go through the JavaScript implementation. | 5665 // Slow-case: Go through the JavaScript implementation. |
| 5665 __ bind(&slow); | 5666 __ bind(&slow); |
| 5666 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); | 5667 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); |
| 5667 } | 5668 } |
| 5668 | 5669 |
| 5669 | 5670 |
| 5670 #undef __ | 5671 #undef __ |
| 5671 | 5672 |
| 5672 } } // namespace v8::internal | 5673 } } // namespace v8::internal |
| OLD | NEW |