| 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 1988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1999 if (key != NULL && key->handle()->IsSymbol()) { | 1999 if (key != NULL && key->handle()->IsSymbol()) { |
| 2000 // Call to a named property, use call IC. | 2000 // Call to a named property, use call IC. |
| 2001 { PreservePositionScope scope(masm()->positions_recorder()); | 2001 { PreservePositionScope scope(masm()->positions_recorder()); |
| 2002 VisitForStackValue(prop->obj()); | 2002 VisitForStackValue(prop->obj()); |
| 2003 } | 2003 } |
| 2004 EmitCallWithIC(expr, key->handle(), RelocInfo::CODE_TARGET); | 2004 EmitCallWithIC(expr, key->handle(), RelocInfo::CODE_TARGET); |
| 2005 } else { | 2005 } else { |
| 2006 // Call to a keyed property. | 2006 // Call to a keyed property. |
| 2007 // For a synthetic property use keyed load IC followed by function call, | 2007 // For a synthetic property use keyed load IC followed by function call, |
| 2008 // for a regular property use keyed EmitCallIC. | 2008 // for a regular property use keyed EmitCallIC. |
| 2009 { PreservePositionScope scope(masm()->positions_recorder()); | |
| 2010 VisitForStackValue(prop->obj()); | |
| 2011 } | |
| 2012 if (prop->is_synthetic()) { | 2009 if (prop->is_synthetic()) { |
| 2013 { PreservePositionScope scope(masm()->positions_recorder()); | 2010 // Do not visit the object and key subexpressions (they are shared |
| 2014 VisitForAccumulatorValue(prop->key()); | 2011 // by all occurrences of the same rewritten parameter). |
| 2015 } | 2012 ASSERT(prop->obj()->AsVariableProxy() != NULL); |
| 2013 ASSERT(prop->obj()->AsVariableProxy()->var()->AsSlot() != NULL); |
| 2014 Slot* slot = prop->obj()->AsVariableProxy()->var()->AsSlot(); |
| 2015 MemOperand operand = EmitSlotSearch(slot, rdx); |
| 2016 __ movq(rdx, operand); |
| 2017 |
| 2018 ASSERT(prop->key()->AsLiteral() != NULL); |
| 2019 ASSERT(prop->key()->AsLiteral()->handle()->IsSmi()); |
| 2020 __ Move(rax, prop->key()->AsLiteral()->handle()); |
| 2021 |
| 2016 // Record source code position for IC call. | 2022 // Record source code position for IC call. |
| 2017 SetSourcePosition(prop->position()); | 2023 SetSourcePosition(prop->position()); |
| 2018 __ pop(rdx); // We do not need to keep the receiver. | |
| 2019 | 2024 |
| 2020 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); | 2025 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); |
| 2021 EmitCallIC(ic, RelocInfo::CODE_TARGET); | 2026 EmitCallIC(ic, RelocInfo::CODE_TARGET); |
| 2022 // Push result (function). | 2027 // Push result (function). |
| 2023 __ push(rax); | 2028 __ push(rax); |
| 2024 // Push Global receiver. | 2029 // Push Global receiver. |
| 2025 __ movq(rcx, GlobalObjectOperand()); | 2030 __ movq(rcx, GlobalObjectOperand()); |
| 2026 __ push(FieldOperand(rcx, GlobalObject::kGlobalReceiverOffset)); | 2031 __ push(FieldOperand(rcx, GlobalObject::kGlobalReceiverOffset)); |
| 2027 EmitCallWithStub(expr); | 2032 EmitCallWithStub(expr); |
| 2028 } else { | 2033 } else { |
| 2034 { PreservePositionScope scope(masm()->positions_recorder()); |
| 2035 VisitForStackValue(prop->obj()); |
| 2036 } |
| 2029 EmitKeyedCallWithIC(expr, prop->key(), RelocInfo::CODE_TARGET); | 2037 EmitKeyedCallWithIC(expr, prop->key(), RelocInfo::CODE_TARGET); |
| 2030 } | 2038 } |
| 2031 } | 2039 } |
| 2032 } else { | 2040 } else { |
| 2033 // Call to some other expression. If the expression is an anonymous | 2041 // Call to some other expression. If the expression is an anonymous |
| 2034 // function literal not called in a loop, mark it as one that should | 2042 // function literal not called in a loop, mark it as one that should |
| 2035 // also use the full code generator. | 2043 // also use the full code generator. |
| 2036 FunctionLiteral* lit = fun->AsFunctionLiteral(); | 2044 FunctionLiteral* lit = fun->AsFunctionLiteral(); |
| 2037 if (lit != NULL && | 2045 if (lit != NULL && |
| 2038 lit->name()->Equals(Heap::empty_string()) && | 2046 lit->name()->Equals(Heap::empty_string()) && |
| (...skipping 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3635 __ ret(0); | 3643 __ ret(0); |
| 3636 } | 3644 } |
| 3637 | 3645 |
| 3638 | 3646 |
| 3639 #undef __ | 3647 #undef __ |
| 3640 | 3648 |
| 3641 | 3649 |
| 3642 } } // namespace v8::internal | 3650 } } // namespace v8::internal |
| 3643 | 3651 |
| 3644 #endif // V8_TARGET_ARCH_X64 | 3652 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |