OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1336 // and y the receiver. | 1336 // and y the receiver. |
1337 VirtualFrame::SpilledScope spilled_scope(frame_); | 1337 VirtualFrame::SpilledScope spilled_scope(frame_); |
1338 | 1338 |
1339 ASSERT(ArgumentsMode() == LAZY_ARGUMENTS_ALLOCATION); | 1339 ASSERT(ArgumentsMode() == LAZY_ARGUMENTS_ALLOCATION); |
1340 ASSERT(arguments->IsArguments()); | 1340 ASSERT(arguments->IsArguments()); |
1341 | 1341 |
1342 // Load applicand.apply onto the stack. This will usually | 1342 // Load applicand.apply onto the stack. This will usually |
1343 // give us a megamorphic load site. Not super, but it works. | 1343 // give us a megamorphic load site. Not super, but it works. |
1344 LoadAndSpill(applicand); | 1344 LoadAndSpill(applicand); |
1345 Handle<String> name = Factory::LookupAsciiSymbol("apply"); | 1345 Handle<String> name = Factory::LookupAsciiSymbol("apply"); |
1346 __ mov(r2, Operand(name)); | 1346 frame_->CallLoadIC(name, RelocInfo::CODE_TARGET); |
1347 __ ldr(r0, MemOperand(sp, 0)); | |
1348 frame_->CallLoadIC(RelocInfo::CODE_TARGET); | |
1349 frame_->EmitPush(r0); | 1347 frame_->EmitPush(r0); |
1350 | 1348 |
1351 // Load the receiver and the existing arguments object onto the | 1349 // Load the receiver and the existing arguments object onto the |
1352 // expression stack. Avoid allocating the arguments object here. | 1350 // expression stack. Avoid allocating the arguments object here. |
1353 LoadAndSpill(receiver); | 1351 LoadAndSpill(receiver); |
1354 LoadFromSlot(scope()->arguments()->var()->slot(), NOT_INSIDE_TYPEOF); | 1352 LoadFromSlot(scope()->arguments()->var()->slot(), NOT_INSIDE_TYPEOF); |
1355 | 1353 |
1356 // Emit the source position information after having loaded the | 1354 // Emit the source position information after having loaded the |
1357 // receiver and the arguments. | 1355 // receiver and the arguments. |
1358 CodeForSourcePosition(position); | 1356 CodeForSourcePosition(position); |
(...skipping 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3005 // Load next context in chain. | 3003 // Load next context in chain. |
3006 __ ldr(tmp, ContextOperand(tmp, Context::CLOSURE_INDEX)); | 3004 __ ldr(tmp, ContextOperand(tmp, Context::CLOSURE_INDEX)); |
3007 __ ldr(tmp, FieldMemOperand(tmp, JSFunction::kContextOffset)); | 3005 __ ldr(tmp, FieldMemOperand(tmp, JSFunction::kContextOffset)); |
3008 __ b(&next); | 3006 __ b(&next); |
3009 __ bind(&fast); | 3007 __ bind(&fast); |
3010 } | 3008 } |
3011 | 3009 |
3012 // Load the global object. | 3010 // Load the global object. |
3013 LoadGlobal(); | 3011 LoadGlobal(); |
3014 // Setup the name register and call load IC. | 3012 // Setup the name register and call load IC. |
3015 frame_->SpillAllButCopyTOSToR0(); | 3013 frame_->CallLoadIC(slot->var()->name(), |
3016 __ mov(r2, Operand(slot->var()->name())); | 3014 typeof_state == INSIDE_TYPEOF |
3017 frame_->CallLoadIC(typeof_state == INSIDE_TYPEOF | 3015 ? RelocInfo::CODE_TARGET |
3018 ? RelocInfo::CODE_TARGET | 3016 : RelocInfo::CODE_TARGET_CONTEXT); |
3019 : RelocInfo::CODE_TARGET_CONTEXT); | |
3020 // Drop the global object. The result is in r0. | 3017 // Drop the global object. The result is in r0. |
3021 frame_->Drop(); | 3018 frame_->Drop(); |
3022 } | 3019 } |
3023 | 3020 |
3024 | 3021 |
3025 void CodeGenerator::VisitSlot(Slot* node) { | 3022 void CodeGenerator::VisitSlot(Slot* node) { |
3026 #ifdef DEBUG | 3023 #ifdef DEBUG |
3027 int original_height = frame_->height(); | 3024 int original_height = frame_->height(); |
3028 #endif | 3025 #endif |
3029 Comment cmnt(masm_, "[ Slot"); | 3026 Comment cmnt(masm_, "[ Slot"); |
(...skipping 2408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5438 // deferred code. | 5435 // deferred code. |
5439 __ BlockConstPoolFor(1); | 5436 __ BlockConstPoolFor(1); |
5440 } | 5437 } |
5441 } | 5438 } |
5442 | 5439 |
5443 | 5440 |
5444 void CodeGenerator::EmitNamedLoad(Handle<String> name, bool is_contextual) { | 5441 void CodeGenerator::EmitNamedLoad(Handle<String> name, bool is_contextual) { |
5445 if (is_contextual || scope()->is_global_scope() || loop_nesting() == 0) { | 5442 if (is_contextual || scope()->is_global_scope() || loop_nesting() == 0) { |
5446 Comment cmnt(masm(), "[ Load from named Property"); | 5443 Comment cmnt(masm(), "[ Load from named Property"); |
5447 // Setup the name register and call load IC. | 5444 // Setup the name register and call load IC. |
5448 frame_->SpillAllButCopyTOSToR0(); | 5445 frame_->CallLoadIC(name, |
5449 __ mov(r2, Operand(name)); | 5446 is_contextual |
5450 frame_->CallLoadIC(is_contextual | 5447 ? RelocInfo::CODE_TARGET_CONTEXT |
5451 ? RelocInfo::CODE_TARGET_CONTEXT | 5448 : RelocInfo::CODE_TARGET); |
5452 : RelocInfo::CODE_TARGET); | |
5453 } else { | 5449 } else { |
5454 // Inline the in-object property case. | 5450 // Inline the in-object property case. |
5455 Comment cmnt(masm(), "[ Inlined named property load"); | 5451 Comment cmnt(masm(), "[ Inlined named property load"); |
5456 | 5452 |
5457 // Counter will be decremented in the deferred code. Placed here to avoid | 5453 // Counter will be decremented in the deferred code. Placed here to avoid |
5458 // having it in the instruction stream below where patching will occur. | 5454 // having it in the instruction stream below where patching will occur. |
5459 __ IncrementCounter(&Counters::named_load_inline, 1, | 5455 __ IncrementCounter(&Counters::named_load_inline, 1, |
5460 frame_->scratch0(), frame_->scratch1()); | 5456 frame_->scratch0(), frame_->scratch1()); |
5461 | 5457 |
5462 // The following instructions are the inlined load of an in-object property. | 5458 // The following instructions are the inlined load of an in-object property. |
(...skipping 4409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9872 | 9868 |
9873 // Just jump to runtime to add the two strings. | 9869 // Just jump to runtime to add the two strings. |
9874 __ bind(&string_add_runtime); | 9870 __ bind(&string_add_runtime); |
9875 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); | 9871 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); |
9876 } | 9872 } |
9877 | 9873 |
9878 | 9874 |
9879 #undef __ | 9875 #undef __ |
9880 | 9876 |
9881 } } // namespace v8::internal | 9877 } } // namespace v8::internal |
OLD | NEW |