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 2321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2332 Property* prop = fun->AsProperty(); | 2332 Property* prop = fun->AsProperty(); |
2333 Literal* key = prop->key()->AsLiteral(); | 2333 Literal* key = prop->key()->AsLiteral(); |
2334 if (key != NULL && key->handle()->IsSymbol()) { | 2334 if (key != NULL && key->handle()->IsSymbol()) { |
2335 // Call to a named property, use call IC. | 2335 // Call to a named property, use call IC. |
2336 VisitForStackValue(prop->obj()); | 2336 VisitForStackValue(prop->obj()); |
2337 EmitCallWithIC(expr, key->handle(), RelocInfo::CODE_TARGET); | 2337 EmitCallWithIC(expr, key->handle(), RelocInfo::CODE_TARGET); |
2338 } else { | 2338 } else { |
2339 // Call to a keyed property. | 2339 // Call to a keyed property. |
2340 // For a synthetic property use keyed load IC followed by function call, | 2340 // For a synthetic property use keyed load IC followed by function call, |
2341 // for a regular property use keyed EmitCallIC. | 2341 // for a regular property use keyed EmitCallIC. |
2342 { PreservePositionScope scope(masm()->positions_recorder()); | |
2343 VisitForStackValue(prop->obj()); | |
2344 } | |
2345 if (prop->is_synthetic()) { | 2342 if (prop->is_synthetic()) { |
2346 { PreservePositionScope scope(masm()->positions_recorder()); | 2343 // Do not visit the object and key subexpressions (they are shared |
2347 VisitForAccumulatorValue(prop->key()); | 2344 // by all occurrences of the same rewritten parameter). |
2348 } | 2345 ASSERT(prop->obj()->AsVariableProxy() != NULL); |
| 2346 ASSERT(prop->obj()->AsVariableProxy()->var()->AsSlot() != NULL); |
| 2347 Slot* slot = prop->obj()->AsVariableProxy()->var()->AsSlot(); |
| 2348 MemOperand operand = EmitSlotSearch(slot, edx); |
| 2349 __ mov(edx, operand); |
| 2350 |
| 2351 ASSERT(prop->key()->AsLiteral() != NULL); |
| 2352 ASSERT(prop->key()->AsLiteral()->handle()->IsSmi()); |
| 2353 __ mov(eax, prop->key()->AsLiteral()->handle()); |
| 2354 |
2349 // Record source code position for IC call. | 2355 // Record source code position for IC call. |
2350 SetSourcePosition(prop->position()); | 2356 SetSourcePosition(prop->position()); |
2351 __ pop(edx); // We do not need to keep the receiver. | |
2352 | 2357 |
2353 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); | 2358 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); |
2354 EmitCallIC(ic, RelocInfo::CODE_TARGET); | 2359 EmitCallIC(ic, RelocInfo::CODE_TARGET); |
2355 // Push result (function). | 2360 // Push result (function). |
2356 __ push(eax); | 2361 __ push(eax); |
2357 // Push Global receiver. | 2362 // Push Global receiver. |
2358 __ mov(ecx, GlobalObjectOperand()); | 2363 __ mov(ecx, GlobalObjectOperand()); |
2359 __ push(FieldOperand(ecx, GlobalObject::kGlobalReceiverOffset)); | 2364 __ push(FieldOperand(ecx, GlobalObject::kGlobalReceiverOffset)); |
2360 EmitCallWithStub(expr); | 2365 EmitCallWithStub(expr); |
2361 } else { | 2366 } else { |
| 2367 { PreservePositionScope scope(masm()->positions_recorder()); |
| 2368 VisitForStackValue(prop->obj()); |
| 2369 } |
2362 EmitKeyedCallWithIC(expr, prop->key(), RelocInfo::CODE_TARGET); | 2370 EmitKeyedCallWithIC(expr, prop->key(), RelocInfo::CODE_TARGET); |
2363 } | 2371 } |
2364 } | 2372 } |
2365 } else { | 2373 } else { |
2366 // Call to some other expression. If the expression is an anonymous | 2374 // Call to some other expression. If the expression is an anonymous |
2367 // function literal not called in a loop, mark it as one that should | 2375 // function literal not called in a loop, mark it as one that should |
2368 // also use the full code generator. | 2376 // also use the full code generator. |
2369 FunctionLiteral* lit = fun->AsFunctionLiteral(); | 2377 FunctionLiteral* lit = fun->AsFunctionLiteral(); |
2370 if (lit != NULL && | 2378 if (lit != NULL && |
2371 lit->name()->Equals(Heap::empty_string()) && | 2379 lit->name()->Equals(Heap::empty_string()) && |
(...skipping 1985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4357 // And return. | 4365 // And return. |
4358 __ ret(0); | 4366 __ ret(0); |
4359 } | 4367 } |
4360 | 4368 |
4361 | 4369 |
4362 #undef __ | 4370 #undef __ |
4363 | 4371 |
4364 } } // namespace v8::internal | 4372 } } // namespace v8::internal |
4365 | 4373 |
4366 #endif // V8_TARGET_ARCH_IA32 | 4374 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |