Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 3501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3512 ASSERT(HasArgsInRegisters()); | 3512 ASSERT(HasArgsInRegisters()); |
| 3513 // Patch the (relocated) inlined map check. | 3513 // Patch the (relocated) inlined map check. |
| 3514 | 3514 |
| 3515 // The offset was stored in r4 safepoint slot. | 3515 // The offset was stored in r4 safepoint slot. |
| 3516 // (See LCodeGen::DoDeferredLInstanceOfKnownGlobal) | 3516 // (See LCodeGen::DoDeferredLInstanceOfKnownGlobal) |
| 3517 __ LoadFromSafepointRegisterSlot(scratch, r4); | 3517 __ LoadFromSafepointRegisterSlot(scratch, r4); |
| 3518 __ sub(inline_site, lr, scratch); | 3518 __ sub(inline_site, lr, scratch); |
| 3519 // Get the map location in scratch and patch it. | 3519 // Get the map location in scratch and patch it. |
| 3520 __ GetRelocatedValueLocation(inline_site, scratch); | 3520 __ GetRelocatedValueLocation(inline_site, scratch); |
| 3521 __ ldr(scratch, MemOperand(scratch)); | 3521 __ ldr(scratch, MemOperand(scratch)); |
| 3522 __ str(map, FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset)); | 3522 __ str(map, FieldMemOperand(scratch, Cell::kValueOffset)); |
| 3523 } | 3523 } |
| 3524 | 3524 |
| 3525 // Register mapping: r3 is object map and r4 is function prototype. | 3525 // Register mapping: r3 is object map and r4 is function prototype. |
| 3526 // Get prototype of object into r2. | 3526 // Get prototype of object into r2. |
| 3527 __ ldr(scratch, FieldMemOperand(map, Map::kPrototypeOffset)); | 3527 __ ldr(scratch, FieldMemOperand(map, Map::kPrototypeOffset)); |
| 3528 | 3528 |
| 3529 // We don't need map any more. Use it as a scratch register. | 3529 // We don't need map any more. Use it as a scratch register. |
| 3530 Register scratch2 = map; | 3530 Register scratch2 = map; |
| 3531 map = no_reg; | 3531 map = no_reg; |
| 3532 | 3532 |
| (...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4645 // r1 : the function to call | 4645 // r1 : the function to call |
| 4646 // r2 : cache cell for call target | 4646 // r2 : cache cell for call target |
| 4647 Label done; | 4647 Label done; |
| 4648 | 4648 |
| 4649 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), | 4649 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), |
| 4650 masm->isolate()->heap()->undefined_value()); | 4650 masm->isolate()->heap()->undefined_value()); |
| 4651 ASSERT_EQ(*TypeFeedbackCells::UninitializedSentinel(masm->isolate()), | 4651 ASSERT_EQ(*TypeFeedbackCells::UninitializedSentinel(masm->isolate()), |
| 4652 masm->isolate()->heap()->the_hole_value()); | 4652 masm->isolate()->heap()->the_hole_value()); |
| 4653 | 4653 |
| 4654 // Load the cache state into r3. | 4654 // Load the cache state into r3. |
| 4655 __ ldr(r3, FieldMemOperand(r2, JSGlobalPropertyCell::kValueOffset)); | 4655 __ ldr(r3, FieldMemOperand(r2, Cell::kValueOffset)); |
| 4656 | 4656 |
| 4657 // A monomorphic cache hit or an already megamorphic state: invoke the | 4657 // A monomorphic cache hit or an already megamorphic state: invoke the |
| 4658 // function without changing the state. | 4658 // function without changing the state. |
| 4659 __ cmp(r3, r1); | 4659 __ cmp(r3, r1); |
| 4660 __ b(eq, &done); | 4660 __ b(eq, &done); |
| 4661 __ CompareRoot(r3, Heap::kUndefinedValueRootIndex); | 4661 __ CompareRoot(r3, Heap::kUndefinedValueRootIndex); |
| 4662 __ b(eq, &done); | 4662 __ b(eq, &done); |
| 4663 | 4663 |
| 4664 // A monomorphic miss (i.e, here the cache is not uninitialized) goes | 4664 // A monomorphic miss (i.e, here the cache is not uninitialized) goes |
| 4665 // megamorphic. | 4665 // megamorphic. |
| 4666 __ CompareRoot(r3, Heap::kTheHoleValueRootIndex); | 4666 __ CompareRoot(r3, Heap::kTheHoleValueRootIndex); |
| 4667 // MegamorphicSentinel is an immortal immovable object (undefined) so no | 4667 // MegamorphicSentinel is an immortal immovable object (undefined) so no |
| 4668 // write-barrier is needed. | 4668 // write-barrier is needed. |
| 4669 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex, ne); | 4669 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex, ne); |
| 4670 __ str(ip, FieldMemOperand(r2, JSGlobalPropertyCell::kValueOffset), ne); | 4670 __ str(ip, FieldMemOperand(r2, Cell::kValueOffset), ne); |
| 4671 | 4671 |
| 4672 // An uninitialized cache is patched with the function. | 4672 // An uninitialized cache is patched with the function. |
| 4673 __ str(r1, FieldMemOperand(r2, JSGlobalPropertyCell::kValueOffset), eq); | 4673 __ str(r1, FieldMemOperand(r2, Cell::kValueOffset), eq); |
| 4674 // No need for a write barrier here - cells are rescanned. | 4674 // No need for a write barrier here - cells are rescanned. |
| 4675 | 4675 |
| 4676 __ bind(&done); | 4676 __ bind(&done); |
| 4677 } | 4677 } |
| 4678 | 4678 |
| 4679 | 4679 |
| 4680 static void GenerateRecordCallTarget(MacroAssembler* masm) { | 4680 static void GenerateRecordCallTarget(MacroAssembler* masm) { |
| 4681 // Cache the called function in a global property cell. Cache states | 4681 // Cache the called function in a global property cell. Cache states |
| 4682 // are uninitialized, monomorphic (indicated by a JSFunction), and | 4682 // are uninitialized, monomorphic (indicated by a JSFunction), and |
| 4683 // megamorphic. | 4683 // megamorphic. |
| 4684 // r1 : the function to call | 4684 // r1 : the function to call |
| 4685 // r2 : cache cell for call target | 4685 // r2 : cache cell for call target |
| 4686 ASSERT(FLAG_optimize_constructed_arrays); | 4686 ASSERT(FLAG_optimize_constructed_arrays); |
| 4687 Label initialize, done, miss, megamorphic, not_array_function; | 4687 Label initialize, done, miss, megamorphic, not_array_function; |
| 4688 | 4688 |
| 4689 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), | 4689 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), |
| 4690 masm->isolate()->heap()->undefined_value()); | 4690 masm->isolate()->heap()->undefined_value()); |
| 4691 ASSERT_EQ(*TypeFeedbackCells::UninitializedSentinel(masm->isolate()), | 4691 ASSERT_EQ(*TypeFeedbackCells::UninitializedSentinel(masm->isolate()), |
| 4692 masm->isolate()->heap()->the_hole_value()); | 4692 masm->isolate()->heap()->the_hole_value()); |
| 4693 | 4693 |
| 4694 // Load the cache state into r3. | 4694 // Load the cache state into r3. |
| 4695 __ ldr(r3, FieldMemOperand(r2, JSGlobalPropertyCell::kValueOffset)); | 4695 __ ldr(r3, FieldMemOperand(r2, Cell::kValueOffset)); |
| 4696 | 4696 |
| 4697 // A monomorphic cache hit or an already megamorphic state: invoke the | 4697 // A monomorphic cache hit or an already megamorphic state: invoke the |
| 4698 // function without changing the state. | 4698 // function without changing the state. |
| 4699 __ cmp(r3, r1); | 4699 __ cmp(r3, r1); |
| 4700 __ b(eq, &done); | 4700 __ b(eq, &done); |
| 4701 __ CompareRoot(r3, Heap::kUndefinedValueRootIndex); | 4701 __ CompareRoot(r3, Heap::kUndefinedValueRootIndex); |
| 4702 __ b(eq, &done); | 4702 __ b(eq, &done); |
| 4703 | 4703 |
| 4704 // Special handling of the Array() function, which caches not only the | 4704 // Special handling of the Array() function, which caches not only the |
| 4705 // monomorphic Array function but the initial ElementsKind with special | 4705 // monomorphic Array function but the initial ElementsKind with special |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 4719 __ bind(&miss); | 4719 __ bind(&miss); |
| 4720 | 4720 |
| 4721 // A monomorphic miss (i.e, here the cache is not uninitialized) goes | 4721 // A monomorphic miss (i.e, here the cache is not uninitialized) goes |
| 4722 // megamorphic. | 4722 // megamorphic. |
| 4723 __ CompareRoot(r3, Heap::kTheHoleValueRootIndex); | 4723 __ CompareRoot(r3, Heap::kTheHoleValueRootIndex); |
| 4724 __ b(eq, &initialize); | 4724 __ b(eq, &initialize); |
| 4725 // MegamorphicSentinel is an immortal immovable object (undefined) so no | 4725 // MegamorphicSentinel is an immortal immovable object (undefined) so no |
| 4726 // write-barrier is needed. | 4726 // write-barrier is needed. |
| 4727 __ bind(&megamorphic); | 4727 __ bind(&megamorphic); |
| 4728 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); | 4728 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
| 4729 __ str(ip, FieldMemOperand(r2, JSGlobalPropertyCell::kValueOffset)); | 4729 __ str(ip, FieldMemOperand(r2, Cell::kValueOffset)); |
| 4730 __ jmp(&done); | 4730 __ jmp(&done); |
| 4731 | 4731 |
| 4732 // An uninitialized cache is patched with the function or sentinel to | 4732 // An uninitialized cache is patched with the function or sentinel to |
| 4733 // indicate the ElementsKind if function is the Array constructor. | 4733 // indicate the ElementsKind if function is the Array constructor. |
| 4734 __ bind(&initialize); | 4734 __ bind(&initialize); |
| 4735 // Make sure the function is the Array() function | 4735 // Make sure the function is the Array() function |
| 4736 __ LoadArrayFunction(r3); | 4736 __ LoadArrayFunction(r3); |
| 4737 __ cmp(r1, r3); | 4737 __ cmp(r1, r3); |
| 4738 __ b(ne, ¬_array_function); | 4738 __ b(ne, ¬_array_function); |
| 4739 | 4739 |
| 4740 // The target function is the Array constructor, install a sentinel value in | 4740 // The target function is the Array constructor, install a sentinel value in |
| 4741 // the constructor's type info cell that will track the initial ElementsKind | 4741 // the constructor's type info cell that will track the initial ElementsKind |
| 4742 // that should be used for the array when its constructed. | 4742 // that should be used for the array when its constructed. |
| 4743 Handle<Object> initial_kind_sentinel = | 4743 Handle<Object> initial_kind_sentinel = |
| 4744 TypeFeedbackCells::MonomorphicArraySentinel(masm->isolate(), | 4744 TypeFeedbackCells::MonomorphicArraySentinel(masm->isolate(), |
| 4745 GetInitialFastElementsKind()); | 4745 GetInitialFastElementsKind()); |
| 4746 __ mov(r3, Operand(initial_kind_sentinel)); | 4746 __ mov(r3, Operand(initial_kind_sentinel)); |
| 4747 __ str(r3, FieldMemOperand(r2, JSGlobalPropertyCell::kValueOffset)); | 4747 __ str(r3, FieldMemOperand(r2, Cell::kValueOffset)); |
| 4748 __ b(&done); | 4748 __ b(&done); |
| 4749 | 4749 |
| 4750 __ bind(¬_array_function); | 4750 __ bind(¬_array_function); |
| 4751 __ str(r1, FieldMemOperand(r2, JSGlobalPropertyCell::kValueOffset)); | 4751 __ str(r1, FieldMemOperand(r2, Cell::kValueOffset)); |
| 4752 // No need for a write barrier here - cells are rescanned. | 4752 // No need for a write barrier here - cells are rescanned. |
| 4753 | 4753 |
| 4754 __ bind(&done); | 4754 __ bind(&done); |
| 4755 } | 4755 } |
| 4756 | 4756 |
| 4757 | 4757 |
| 4758 void CallFunctionStub::Generate(MacroAssembler* masm) { | 4758 void CallFunctionStub::Generate(MacroAssembler* masm) { |
| 4759 // r1 : the function to call | 4759 // r1 : the function to call |
| 4760 // r2 : cache cell for call target | 4760 // r2 : cache cell for call target |
| 4761 Label slow, non_function; | 4761 Label slow, non_function; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4817 | 4817 |
| 4818 // Slow-case: Non-function called. | 4818 // Slow-case: Non-function called. |
| 4819 __ bind(&slow); | 4819 __ bind(&slow); |
| 4820 if (RecordCallTarget()) { | 4820 if (RecordCallTarget()) { |
| 4821 // If there is a call target cache, mark it megamorphic in the | 4821 // If there is a call target cache, mark it megamorphic in the |
| 4822 // non-function case. MegamorphicSentinel is an immortal immovable | 4822 // non-function case. MegamorphicSentinel is an immortal immovable |
| 4823 // object (undefined) so no write barrier is needed. | 4823 // object (undefined) so no write barrier is needed. |
| 4824 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), | 4824 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), |
| 4825 masm->isolate()->heap()->undefined_value()); | 4825 masm->isolate()->heap()->undefined_value()); |
| 4826 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); | 4826 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
| 4827 __ str(ip, FieldMemOperand(r2, JSGlobalPropertyCell::kValueOffset)); | 4827 __ str(ip, FieldMemOperand(r2, Cell::kValueOffset)); |
| 4828 } | 4828 } |
| 4829 // Check for function proxy. | 4829 // Check for function proxy. |
| 4830 __ cmp(r3, Operand(JS_FUNCTION_PROXY_TYPE)); | 4830 __ cmp(r3, Operand(JS_FUNCTION_PROXY_TYPE)); |
| 4831 __ b(ne, &non_function); | 4831 __ b(ne, &non_function); |
| 4832 __ push(r1); // put proxy as additional argument | 4832 __ push(r1); // put proxy as additional argument |
| 4833 __ mov(r0, Operand(argc_ + 1, RelocInfo::NONE32)); | 4833 __ mov(r0, Operand(argc_ + 1, RelocInfo::NONE32)); |
| 4834 __ mov(r2, Operand::Zero()); | 4834 __ mov(r2, Operand::Zero()); |
| 4835 __ GetBuiltinEntry(r3, Builtins::CALL_FUNCTION_PROXY); | 4835 __ GetBuiltinEntry(r3, Builtins::CALL_FUNCTION_PROXY); |
| 4836 __ SetCallKind(r5, CALL_AS_METHOD); | 4836 __ SetCallKind(r5, CALL_AS_METHOD); |
| 4837 { | 4837 { |
| (...skipping 2502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7340 // builtin Array functions which always have maps. | 7340 // builtin Array functions which always have maps. |
| 7341 | 7341 |
| 7342 // Initial map for the builtin Array function should be a map. | 7342 // Initial map for the builtin Array function should be a map. |
| 7343 __ ldr(r3, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset)); | 7343 __ ldr(r3, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset)); |
| 7344 // Will both indicate a NULL and a Smi. | 7344 // Will both indicate a NULL and a Smi. |
| 7345 __ tst(r3, Operand(kSmiTagMask)); | 7345 __ tst(r3, Operand(kSmiTagMask)); |
| 7346 __ Assert(ne, "Unexpected initial map for Array function"); | 7346 __ Assert(ne, "Unexpected initial map for Array function"); |
| 7347 __ CompareObjectType(r3, r3, r4, MAP_TYPE); | 7347 __ CompareObjectType(r3, r3, r4, MAP_TYPE); |
| 7348 __ Assert(eq, "Unexpected initial map for Array function"); | 7348 __ Assert(eq, "Unexpected initial map for Array function"); |
| 7349 | 7349 |
| 7350 // We should either have undefined in ebx or a valid jsglobalpropertycell | 7350 // We should either have undefined in ebx or a valid cell |
| 7351 Label okay_here; | 7351 Label okay_here; |
| 7352 Handle<Map> global_property_cell_map( | 7352 Handle<Map> cell_map( |
|
Michael Starzinger
2013/06/12 13:23:25
nit: Should fit into one line now. Also, better us
danno
2013/06/12 14:24:28
Done.
| |
| 7353 masm->isolate()->heap()->global_property_cell_map()); | 7353 masm->isolate()->heap()->cell_map()); |
| 7354 __ cmp(r2, Operand(undefined_sentinel)); | 7354 __ cmp(r2, Operand(undefined_sentinel)); |
| 7355 __ b(eq, &okay_here); | 7355 __ b(eq, &okay_here); |
| 7356 __ ldr(r3, FieldMemOperand(r2, 0)); | 7356 __ ldr(r3, FieldMemOperand(r2, 0)); |
| 7357 __ cmp(r3, Operand(global_property_cell_map)); | 7357 __ cmp(r3, Operand(cell_map)); |
| 7358 __ Assert(eq, "Expected property cell in register ebx"); | 7358 __ Assert(eq, "Expected property cell in register ebx"); |
| 7359 __ bind(&okay_here); | 7359 __ bind(&okay_here); |
| 7360 } | 7360 } |
| 7361 | 7361 |
| 7362 if (FLAG_optimize_constructed_arrays) { | 7362 if (FLAG_optimize_constructed_arrays) { |
| 7363 Label no_info, switch_ready; | 7363 Label no_info, switch_ready; |
| 7364 // Get the elements kind and case on that. | 7364 // Get the elements kind and case on that. |
| 7365 __ cmp(r2, Operand(undefined_sentinel)); | 7365 __ cmp(r2, Operand(undefined_sentinel)); |
| 7366 __ b(eq, &no_info); | 7366 __ b(eq, &no_info); |
| 7367 __ ldr(r3, FieldMemOperand(r2, JSGlobalPropertyCell::kValueOffset)); | 7367 __ ldr(r3, FieldMemOperand(r2, JSGlobalPropertyCell::kValueOffset)); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7506 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); | 7506 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); |
| 7507 } | 7507 } |
| 7508 } | 7508 } |
| 7509 | 7509 |
| 7510 | 7510 |
| 7511 #undef __ | 7511 #undef __ |
| 7512 | 7512 |
| 7513 } } // namespace v8::internal | 7513 } } // namespace v8::internal |
| 7514 | 7514 |
| 7515 #endif // V8_TARGET_ARCH_ARM | 7515 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |