| 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 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 VisitForStackValue(stmt->tag()); | 704 VisitForStackValue(stmt->tag()); |
| 705 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS); | 705 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS); |
| 706 | 706 |
| 707 ZoneList<CaseClause*>* clauses = stmt->cases(); | 707 ZoneList<CaseClause*>* clauses = stmt->cases(); |
| 708 CaseClause* default_clause = NULL; // Can occur anywhere in the list. | 708 CaseClause* default_clause = NULL; // Can occur anywhere in the list. |
| 709 | 709 |
| 710 Label next_test; // Recycled for each test. | 710 Label next_test; // Recycled for each test. |
| 711 // Compile all the tests with branches to their bodies. | 711 // Compile all the tests with branches to their bodies. |
| 712 for (int i = 0; i < clauses->length(); i++) { | 712 for (int i = 0; i < clauses->length(); i++) { |
| 713 CaseClause* clause = clauses->at(i); | 713 CaseClause* clause = clauses->at(i); |
| 714 clause->body_target()->entry_label()->Unuse(); |
| 715 |
| 714 // The default is not a test, but remember it as final fall through. | 716 // The default is not a test, but remember it as final fall through. |
| 715 if (clause->is_default()) { | 717 if (clause->is_default()) { |
| 716 default_clause = clause; | 718 default_clause = clause; |
| 717 continue; | 719 continue; |
| 718 } | 720 } |
| 719 | 721 |
| 720 Comment cmnt(masm_, "[ Case comparison"); | 722 Comment cmnt(masm_, "[ Case comparison"); |
| 721 __ bind(&next_test); | 723 __ bind(&next_test); |
| 722 next_test.Unuse(); | 724 next_test.Unuse(); |
| 723 | 725 |
| (...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2017 if (key != NULL && key->handle()->IsSymbol()) { | 2019 if (key != NULL && key->handle()->IsSymbol()) { |
| 2018 // Call to a named property, use call IC. | 2020 // Call to a named property, use call IC. |
| 2019 { PreservePositionScope scope(masm()->positions_recorder()); | 2021 { PreservePositionScope scope(masm()->positions_recorder()); |
| 2020 VisitForStackValue(prop->obj()); | 2022 VisitForStackValue(prop->obj()); |
| 2021 } | 2023 } |
| 2022 EmitCallWithIC(expr, key->handle(), RelocInfo::CODE_TARGET); | 2024 EmitCallWithIC(expr, key->handle(), RelocInfo::CODE_TARGET); |
| 2023 } else { | 2025 } else { |
| 2024 // Call to a keyed property. | 2026 // Call to a keyed property. |
| 2025 // For a synthetic property use keyed load IC followed by function call, | 2027 // For a synthetic property use keyed load IC followed by function call, |
| 2026 // for a regular property use keyed EmitCallIC. | 2028 // for a regular property use keyed EmitCallIC. |
| 2027 { PreservePositionScope scope(masm()->positions_recorder()); | |
| 2028 VisitForStackValue(prop->obj()); | |
| 2029 } | |
| 2030 if (prop->is_synthetic()) { | 2029 if (prop->is_synthetic()) { |
| 2031 { PreservePositionScope scope(masm()->positions_recorder()); | 2030 // Do not visit the object and key subexpressions (they are shared |
| 2032 VisitForAccumulatorValue(prop->key()); | 2031 // by all occurrences of the same rewritten parameter). |
| 2033 } | 2032 ASSERT(prop->obj()->AsVariableProxy() != NULL); |
| 2033 ASSERT(prop->obj()->AsVariableProxy()->var()->AsSlot() != NULL); |
| 2034 Slot* slot = prop->obj()->AsVariableProxy()->var()->AsSlot(); |
| 2035 MemOperand operand = EmitSlotSearch(slot, rdx); |
| 2036 __ movq(rdx, operand); |
| 2037 |
| 2038 ASSERT(prop->key()->AsLiteral() != NULL); |
| 2039 ASSERT(prop->key()->AsLiteral()->handle()->IsSmi()); |
| 2040 __ Move(rax, prop->key()->AsLiteral()->handle()); |
| 2041 |
| 2034 // Record source code position for IC call. | 2042 // Record source code position for IC call. |
| 2035 SetSourcePosition(prop->position()); | 2043 SetSourcePosition(prop->position()); |
| 2036 __ pop(rdx); // We do not need to keep the receiver. | |
| 2037 | 2044 |
| 2038 Handle<Code> ic(isolate()->builtins()->builtin( | 2045 Handle<Code> ic(isolate()->builtins()->builtin( |
| 2039 Builtins::KeyedLoadIC_Initialize)); | 2046 Builtins::KeyedLoadIC_Initialize)); |
| 2040 EmitCallIC(ic, RelocInfo::CODE_TARGET); | 2047 EmitCallIC(ic, RelocInfo::CODE_TARGET); |
| 2041 // Push result (function). | 2048 // Push result (function). |
| 2042 __ push(rax); | 2049 __ push(rax); |
| 2043 // Push Global receiver. | 2050 // Push Global receiver. |
| 2044 __ movq(rcx, GlobalObjectOperand()); | 2051 __ movq(rcx, GlobalObjectOperand()); |
| 2045 __ push(FieldOperand(rcx, GlobalObject::kGlobalReceiverOffset)); | 2052 __ push(FieldOperand(rcx, GlobalObject::kGlobalReceiverOffset)); |
| 2046 EmitCallWithStub(expr); | 2053 EmitCallWithStub(expr); |
| 2047 } else { | 2054 } else { |
| 2055 { PreservePositionScope scope(masm()->positions_recorder()); |
| 2056 VisitForStackValue(prop->obj()); |
| 2057 } |
| 2048 EmitKeyedCallWithIC(expr, prop->key(), RelocInfo::CODE_TARGET); | 2058 EmitKeyedCallWithIC(expr, prop->key(), RelocInfo::CODE_TARGET); |
| 2049 } | 2059 } |
| 2050 } | 2060 } |
| 2051 } else { | 2061 } else { |
| 2052 // Call to some other expression. If the expression is an anonymous | 2062 // Call to some other expression. If the expression is an anonymous |
| 2053 // function literal not called in a loop, mark it as one that should | 2063 // function literal not called in a loop, mark it as one that should |
| 2054 // also use the full code generator. | 2064 // also use the full code generator. |
| 2055 FunctionLiteral* lit = fun->AsFunctionLiteral(); | 2065 FunctionLiteral* lit = fun->AsFunctionLiteral(); |
| 2056 if (lit != NULL && | 2066 if (lit != NULL && |
| 2057 lit->name()->Equals(isolate()->heap()->empty_string()) && | 2067 lit->name()->Equals(isolate()->heap()->empty_string()) && |
| (...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3012 var->AsSlot()->type() != Slot::LOOKUP) { | 3022 var->AsSlot()->type() != Slot::LOOKUP) { |
| 3013 // Result of deleting non-global, non-dynamic variables is false. | 3023 // Result of deleting non-global, non-dynamic variables is false. |
| 3014 // The subexpression does not have side effects. | 3024 // The subexpression does not have side effects. |
| 3015 context()->Plug(false); | 3025 context()->Plug(false); |
| 3016 } else { | 3026 } else { |
| 3017 // Property or variable reference. Call the delete builtin with | 3027 // Property or variable reference. Call the delete builtin with |
| 3018 // object and property name as arguments. | 3028 // object and property name as arguments. |
| 3019 if (prop != NULL) { | 3029 if (prop != NULL) { |
| 3020 VisitForStackValue(prop->obj()); | 3030 VisitForStackValue(prop->obj()); |
| 3021 VisitForStackValue(prop->key()); | 3031 VisitForStackValue(prop->key()); |
| 3032 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); |
| 3022 } else if (var->is_global()) { | 3033 } else if (var->is_global()) { |
| 3023 __ push(GlobalObjectOperand()); | 3034 __ push(GlobalObjectOperand()); |
| 3024 __ Push(var->name()); | 3035 __ Push(var->name()); |
| 3036 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); |
| 3025 } else { | 3037 } else { |
| 3026 // Non-global variable. Call the runtime to look up the context | 3038 // Non-global variable. Call the runtime to delete from the |
| 3027 // where the variable was introduced. | 3039 // context where the variable was introduced. |
| 3028 __ push(context_register()); | 3040 __ push(context_register()); |
| 3029 __ Push(var->name()); | 3041 __ Push(var->name()); |
| 3030 __ CallRuntime(Runtime::kLookupContext, 2); | 3042 __ CallRuntime(Runtime::kDeleteContextSlot, 2); |
| 3031 __ push(rax); | |
| 3032 __ Push(var->name()); | |
| 3033 } | 3043 } |
| 3034 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); | |
| 3035 context()->Plug(rax); | 3044 context()->Plug(rax); |
| 3036 } | 3045 } |
| 3037 break; | 3046 break; |
| 3038 } | 3047 } |
| 3039 | 3048 |
| 3040 case Token::VOID: { | 3049 case Token::VOID: { |
| 3041 Comment cmnt(masm_, "[ UnaryOperation (VOID)"); | 3050 Comment cmnt(masm_, "[ UnaryOperation (VOID)"); |
| 3042 VisitForEffect(expr->expression()); | 3051 VisitForEffect(expr->expression()); |
| 3043 context()->Plug(Heap::kUndefinedValueRootIndex); | 3052 context()->Plug(Heap::kUndefinedValueRootIndex); |
| 3044 break; | 3053 break; |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3659 __ ret(0); | 3668 __ ret(0); |
| 3660 } | 3669 } |
| 3661 | 3670 |
| 3662 | 3671 |
| 3663 #undef __ | 3672 #undef __ |
| 3664 | 3673 |
| 3665 | 3674 |
| 3666 } } // namespace v8::internal | 3675 } } // namespace v8::internal |
| 3667 | 3676 |
| 3668 #endif // V8_TARGET_ARCH_X64 | 3677 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |