| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 3812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3823 break; | 3823 break; |
| 3824 | 3824 |
| 3825 default: | 3825 default: |
| 3826 UNREACHABLE(); | 3826 UNREACHABLE(); |
| 3827 } | 3827 } |
| 3828 } | 3828 } |
| 3829 | 3829 |
| 3830 | 3830 |
| 3831 void FullCodeGenerator::EmitUnaryOperation(UnaryOperation* expr, | 3831 void FullCodeGenerator::EmitUnaryOperation(UnaryOperation* expr, |
| 3832 const char* comment) { | 3832 const char* comment) { |
| 3833 // TODO(svenpanne): Allowing format strings in Comment would be nice here... | |
| 3834 Comment cmt(masm_, comment); | 3833 Comment cmt(masm_, comment); |
| 3835 bool can_overwrite = expr->expression()->ResultOverwriteAllowed(); | 3834 bool can_overwrite = expr->expression()->ResultOverwriteAllowed(); |
| 3836 UnaryOverwriteMode overwrite = | 3835 UnaryOverwriteMode overwrite = |
| 3837 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; | 3836 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; |
| 3838 UnaryOpStub stub(expr->op(), overwrite); | 3837 UnaryOpStub stub(expr->op(), overwrite); |
| 3839 // UnaryOpStub expects the argument to be in the | 3838 // UnaryOpStub expects the argument to be in the |
| 3840 // accumulator register eax. | 3839 // accumulator register eax. |
| 3841 VisitForAccumulatorValue(expr->expression()); | 3840 VisitForAccumulatorValue(expr->expression()); |
| 3842 SetSourcePosition(expr->position()); | 3841 SetSourcePosition(expr->position()); |
| 3843 __ call(stub.GetCode(), RelocInfo::CODE_TARGET, expr->id()); | 3842 __ call(stub.GetCode(), RelocInfo::CODE_TARGET, expr->id()); |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4098 __ j(above_equal, if_false); | 4097 __ j(above_equal, if_false); |
| 4099 // Check for undetectable objects => false. | 4098 // Check for undetectable objects => false. |
| 4100 __ test_b(FieldOperand(edx, Map::kBitFieldOffset), | 4099 __ test_b(FieldOperand(edx, Map::kBitFieldOffset), |
| 4101 1 << Map::kIsUndetectable); | 4100 1 << Map::kIsUndetectable); |
| 4102 Split(zero, if_true, if_false, fall_through); | 4101 Split(zero, if_true, if_false, fall_through); |
| 4103 } else if (check->Equals(isolate()->heap()->boolean_symbol())) { | 4102 } else if (check->Equals(isolate()->heap()->boolean_symbol())) { |
| 4104 __ cmp(eax, isolate()->factory()->true_value()); | 4103 __ cmp(eax, isolate()->factory()->true_value()); |
| 4105 __ j(equal, if_true); | 4104 __ j(equal, if_true); |
| 4106 __ cmp(eax, isolate()->factory()->false_value()); | 4105 __ cmp(eax, isolate()->factory()->false_value()); |
| 4107 Split(equal, if_true, if_false, fall_through); | 4106 Split(equal, if_true, if_false, fall_through); |
| 4107 } else if (FLAG_harmony_typeof && |
| 4108 check->Equals(isolate()->heap()->null_symbol())) { |
| 4109 __ cmp(eax, isolate()->factory()->null_value()); |
| 4110 Split(equal, if_true, if_false, fall_through); |
| 4108 } else if (check->Equals(isolate()->heap()->undefined_symbol())) { | 4111 } else if (check->Equals(isolate()->heap()->undefined_symbol())) { |
| 4109 __ cmp(eax, isolate()->factory()->undefined_value()); | 4112 __ cmp(eax, isolate()->factory()->undefined_value()); |
| 4110 __ j(equal, if_true); | 4113 __ j(equal, if_true); |
| 4111 __ JumpIfSmi(eax, if_false); | 4114 __ JumpIfSmi(eax, if_false); |
| 4112 // Check for undetectable objects => true. | 4115 // Check for undetectable objects => true. |
| 4113 __ mov(edx, FieldOperand(eax, HeapObject::kMapOffset)); | 4116 __ mov(edx, FieldOperand(eax, HeapObject::kMapOffset)); |
| 4114 __ movzx_b(ecx, FieldOperand(edx, Map::kBitFieldOffset)); | 4117 __ movzx_b(ecx, FieldOperand(edx, Map::kBitFieldOffset)); |
| 4115 __ test(ecx, Immediate(1 << Map::kIsUndetectable)); | 4118 __ test(ecx, Immediate(1 << Map::kIsUndetectable)); |
| 4116 Split(not_zero, if_true, if_false, fall_through); | 4119 Split(not_zero, if_true, if_false, fall_through); |
| 4117 } else if (check->Equals(isolate()->heap()->function_symbol())) { | 4120 } else if (check->Equals(isolate()->heap()->function_symbol())) { |
| 4118 __ JumpIfSmi(eax, if_false); | 4121 __ JumpIfSmi(eax, if_false); |
| 4119 __ CmpObjectType(eax, FIRST_CALLABLE_SPEC_OBJECT_TYPE, edx); | 4122 __ CmpObjectType(eax, FIRST_CALLABLE_SPEC_OBJECT_TYPE, edx); |
| 4120 Split(above_equal, if_true, if_false, fall_through); | 4123 Split(above_equal, if_true, if_false, fall_through); |
| 4121 } else if (check->Equals(isolate()->heap()->object_symbol())) { | 4124 } else if (check->Equals(isolate()->heap()->object_symbol())) { |
| 4122 __ JumpIfSmi(eax, if_false); | 4125 __ JumpIfSmi(eax, if_false); |
| 4123 __ cmp(eax, isolate()->factory()->null_value()); | 4126 if (!FLAG_harmony_typeof) { |
| 4124 __ j(equal, if_true); | 4127 __ cmp(eax, isolate()->factory()->null_value()); |
| 4128 __ j(equal, if_true); |
| 4129 } |
| 4125 __ CmpObjectType(eax, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, edx); | 4130 __ CmpObjectType(eax, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, edx); |
| 4126 __ j(below, if_false); | 4131 __ j(below, if_false); |
| 4127 __ CmpInstanceType(edx, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); | 4132 __ CmpInstanceType(edx, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); |
| 4128 __ j(above, if_false); | 4133 __ j(above, if_false); |
| 4129 // Check for undetectable objects => false. | 4134 // Check for undetectable objects => false. |
| 4130 __ test_b(FieldOperand(edx, Map::kBitFieldOffset), | 4135 __ test_b(FieldOperand(edx, Map::kBitFieldOffset), |
| 4131 1 << Map::kIsUndetectable); | 4136 1 << Map::kIsUndetectable); |
| 4132 Split(zero, if_true, if_false, fall_through); | 4137 Split(zero, if_true, if_false, fall_through); |
| 4133 } else { | 4138 } else { |
| 4134 if (if_false != fall_through) __ jmp(if_false); | 4139 if (if_false != fall_through) __ jmp(if_false); |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4364 __ add(Operand(edx), Immediate(masm_->CodeObject())); | 4369 __ add(Operand(edx), Immediate(masm_->CodeObject())); |
| 4365 __ jmp(Operand(edx)); | 4370 __ jmp(Operand(edx)); |
| 4366 } | 4371 } |
| 4367 | 4372 |
| 4368 | 4373 |
| 4369 #undef __ | 4374 #undef __ |
| 4370 | 4375 |
| 4371 } } // namespace v8::internal | 4376 } } // namespace v8::internal |
| 4372 | 4377 |
| 4373 #endif // V8_TARGET_ARCH_IA32 | 4378 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |