OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_X87 | 5 #if V8_TARGET_ARCH_X87 |
6 | 6 |
7 #include "src/full-codegen/full-codegen.h" | 7 #include "src/full-codegen/full-codegen.h" |
8 #include "src/ast/compile-time-value.h" | 8 #include "src/ast/compile-time-value.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
940 // it to a JS receiver. See ECMA-262 version 5, section 12.6.4. | 940 // it to a JS receiver. See ECMA-262 version 5, section 12.6.4. |
941 Label convert, done_convert; | 941 Label convert, done_convert; |
942 __ JumpIfSmi(eax, &convert, Label::kNear); | 942 __ JumpIfSmi(eax, &convert, Label::kNear); |
943 __ CmpObjectType(eax, FIRST_JS_RECEIVER_TYPE, ecx); | 943 __ CmpObjectType(eax, FIRST_JS_RECEIVER_TYPE, ecx); |
944 __ j(above_equal, &done_convert, Label::kNear); | 944 __ j(above_equal, &done_convert, Label::kNear); |
945 __ cmp(eax, isolate()->factory()->undefined_value()); | 945 __ cmp(eax, isolate()->factory()->undefined_value()); |
946 __ j(equal, &exit); | 946 __ j(equal, &exit); |
947 __ cmp(eax, isolate()->factory()->null_value()); | 947 __ cmp(eax, isolate()->factory()->null_value()); |
948 __ j(equal, &exit); | 948 __ j(equal, &exit); |
949 __ bind(&convert); | 949 __ bind(&convert); |
950 ToObjectStub stub(isolate()); | 950 __ Call(isolate()->builtins()->ToObject(), RelocInfo::CODE_TARGET); |
951 __ CallStub(&stub); | |
952 RestoreContext(); | 951 RestoreContext(); |
953 __ bind(&done_convert); | 952 __ bind(&done_convert); |
954 PrepareForBailoutForId(stmt->ToObjectId(), BailoutState::TOS_REGISTER); | 953 PrepareForBailoutForId(stmt->ToObjectId(), BailoutState::TOS_REGISTER); |
955 __ push(eax); | 954 __ push(eax); |
956 | 955 |
957 // Check cache validity in generated code. If we cannot guarantee cache | 956 // Check cache validity in generated code. If we cannot guarantee cache |
958 // validity, call the runtime system to check cache validity or get the | 957 // validity, call the runtime system to check cache validity or get the |
959 // property names in a fixed array. Note: Proxies never have an enum cache, | 958 // property names in a fixed array. Note: Proxies never have an enum cache, |
960 // so will always take the slow path. | 959 // so will always take the slow path. |
961 Label call_runtime, use_cache, fixed_array; | 960 Label call_runtime, use_cache, fixed_array; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1030 __ cmp(edx, FieldOperand(ebx, HeapObject::kMapOffset)); | 1029 __ cmp(edx, FieldOperand(ebx, HeapObject::kMapOffset)); |
1031 __ j(equal, &update_each, Label::kNear); | 1030 __ j(equal, &update_each, Label::kNear); |
1032 | 1031 |
1033 // We need to filter the key, record slow-path here. | 1032 // We need to filter the key, record slow-path here. |
1034 int const vector_index = SmiFromSlot(slot)->value(); | 1033 int const vector_index = SmiFromSlot(slot)->value(); |
1035 __ EmitLoadTypeFeedbackVector(edx); | 1034 __ EmitLoadTypeFeedbackVector(edx); |
1036 __ mov(FieldOperand(edx, FixedArray::OffsetOfElementAt(vector_index)), | 1035 __ mov(FieldOperand(edx, FixedArray::OffsetOfElementAt(vector_index)), |
1037 Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate()))); | 1036 Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate()))); |
1038 | 1037 |
1039 // eax contains the key. The receiver in ebx is the second argument to the | 1038 // eax contains the key. The receiver in ebx is the second argument to the |
1040 // ForInFilterStub. ForInFilter returns undefined if the receiver doesn't | 1039 // ForInFilter. ForInFilter returns undefined if the receiver doesn't |
1041 // have the key or returns the name-converted key. | 1040 // have the key or returns the name-converted key. |
1042 ForInFilterStub filter_stub(isolate()); | 1041 __ Call(isolate()->builtins()->ForInFilter(), RelocInfo::CODE_TARGET); |
1043 __ CallStub(&filter_stub); | |
1044 RestoreContext(); | 1042 RestoreContext(); |
1045 PrepareForBailoutForId(stmt->FilterId(), BailoutState::TOS_REGISTER); | 1043 PrepareForBailoutForId(stmt->FilterId(), BailoutState::TOS_REGISTER); |
1046 __ JumpIfRoot(result_register(), Heap::kUndefinedValueRootIndex, | 1044 __ JumpIfRoot(result_register(), Heap::kUndefinedValueRootIndex, |
1047 loop_statement.continue_label()); | 1045 loop_statement.continue_label()); |
1048 | 1046 |
1049 // Update the 'each' property or variable from the possibly filtered | 1047 // Update the 'each' property or variable from the possibly filtered |
1050 // entry in register eax. | 1048 // entry in register eax. |
1051 __ bind(&update_each); | 1049 __ bind(&update_each); |
1052 // Perform the assignment as if via '='. | 1050 // Perform the assignment as if via '='. |
1053 { EffectContext context(this); | 1051 { EffectContext context(this); |
(...skipping 1877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2931 break; | 2929 break; |
2932 } | 2930 } |
2933 | 2931 |
2934 case Token::TYPEOF: { | 2932 case Token::TYPEOF: { |
2935 Comment cmnt(masm_, "[ UnaryOperation (TYPEOF)"); | 2933 Comment cmnt(masm_, "[ UnaryOperation (TYPEOF)"); |
2936 { | 2934 { |
2937 AccumulatorValueContext context(this); | 2935 AccumulatorValueContext context(this); |
2938 VisitForTypeofValue(expr->expression()); | 2936 VisitForTypeofValue(expr->expression()); |
2939 } | 2937 } |
2940 __ mov(ebx, eax); | 2938 __ mov(ebx, eax); |
2941 TypeofStub typeof_stub(isolate()); | 2939 __ Call(isolate()->builtins()->Typeof(), RelocInfo::CODE_TARGET); |
2942 __ CallStub(&typeof_stub); | |
2943 context()->Plug(eax); | 2940 context()->Plug(eax); |
2944 break; | 2941 break; |
2945 } | 2942 } |
2946 | 2943 |
2947 default: | 2944 default: |
2948 UNREACHABLE(); | 2945 UNREACHABLE(); |
2949 } | 2946 } |
2950 } | 2947 } |
2951 | 2948 |
2952 | 2949 |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3302 EmitHasProperty(); | 3299 EmitHasProperty(); |
3303 PrepareForBailoutBeforeSplit(expr, false, NULL, NULL); | 3300 PrepareForBailoutBeforeSplit(expr, false, NULL, NULL); |
3304 __ cmp(eax, isolate()->factory()->true_value()); | 3301 __ cmp(eax, isolate()->factory()->true_value()); |
3305 Split(equal, if_true, if_false, fall_through); | 3302 Split(equal, if_true, if_false, fall_through); |
3306 break; | 3303 break; |
3307 | 3304 |
3308 case Token::INSTANCEOF: { | 3305 case Token::INSTANCEOF: { |
3309 VisitForAccumulatorValue(expr->right()); | 3306 VisitForAccumulatorValue(expr->right()); |
3310 SetExpressionPosition(expr); | 3307 SetExpressionPosition(expr); |
3311 PopOperand(edx); | 3308 PopOperand(edx); |
3312 InstanceOfStub stub(isolate()); | 3309 __ Call(isolate()->builtins()->InstanceOf(), RelocInfo::CODE_TARGET); |
3313 __ CallStub(&stub); | |
3314 PrepareForBailoutBeforeSplit(expr, false, NULL, NULL); | 3310 PrepareForBailoutBeforeSplit(expr, false, NULL, NULL); |
3315 __ cmp(eax, isolate()->factory()->true_value()); | 3311 __ cmp(eax, isolate()->factory()->true_value()); |
3316 Split(equal, if_true, if_false, fall_through); | 3312 Split(equal, if_true, if_false, fall_through); |
3317 break; | 3313 break; |
3318 } | 3314 } |
3319 | 3315 |
3320 default: { | 3316 default: { |
3321 VisitForAccumulatorValue(expr->right()); | 3317 VisitForAccumulatorValue(expr->right()); |
3322 SetExpressionPosition(expr); | 3318 SetExpressionPosition(expr); |
3323 Condition cc = CompareIC::ComputeCondition(op); | 3319 Condition cc = CompareIC::ComputeCondition(op); |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3558 isolate->builtins()->OnStackReplacement()->entry(), | 3554 isolate->builtins()->OnStackReplacement()->entry(), |
3559 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3555 Assembler::target_address_at(call_target_address, unoptimized_code)); |
3560 return ON_STACK_REPLACEMENT; | 3556 return ON_STACK_REPLACEMENT; |
3561 } | 3557 } |
3562 | 3558 |
3563 | 3559 |
3564 } // namespace internal | 3560 } // namespace internal |
3565 } // namespace v8 | 3561 } // namespace v8 |
3566 | 3562 |
3567 #endif // V8_TARGET_ARCH_X87 | 3563 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |