| 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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 } | 583 } |
| 584 } | 584 } |
| 585 } | 585 } |
| 586 | 586 |
| 587 | 587 |
| 588 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) { | 588 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) { |
| 589 int length = deoptimizations_.length(); | 589 int length = deoptimizations_.length(); |
| 590 if (length == 0) return; | 590 if (length == 0) return; |
| 591 ASSERT(FLAG_deopt); | 591 ASSERT(FLAG_deopt); |
| 592 Handle<DeoptimizationInputData> data = | 592 Handle<DeoptimizationInputData> data = |
| 593 FACTORY->NewDeoptimizationInputData(length, TENURED); | 593 factory()->NewDeoptimizationInputData(length, TENURED); |
| 594 | 594 |
| 595 Handle<ByteArray> translations = translations_.CreateByteArray(); | 595 Handle<ByteArray> translations = translations_.CreateByteArray(); |
| 596 data->SetTranslationByteArray(*translations); | 596 data->SetTranslationByteArray(*translations); |
| 597 data->SetInlinedFunctionCount(Smi::FromInt(inlined_function_count_)); | 597 data->SetInlinedFunctionCount(Smi::FromInt(inlined_function_count_)); |
| 598 | 598 |
| 599 Handle<FixedArray> literals = | 599 Handle<FixedArray> literals = |
| 600 FACTORY->NewFixedArray(deoptimization_literals_.length(), TENURED); | 600 factory()->NewFixedArray(deoptimization_literals_.length(), TENURED); |
| 601 for (int i = 0; i < deoptimization_literals_.length(); i++) { | 601 for (int i = 0; i < deoptimization_literals_.length(); i++) { |
| 602 literals->set(i, *deoptimization_literals_[i]); | 602 literals->set(i, *deoptimization_literals_[i]); |
| 603 } | 603 } |
| 604 data->SetLiteralArray(*literals); | 604 data->SetLiteralArray(*literals); |
| 605 | 605 |
| 606 data->SetOsrAstId(Smi::FromInt(info_->osr_ast_id())); | 606 data->SetOsrAstId(Smi::FromInt(info_->osr_ast_id())); |
| 607 data->SetOsrPcOffset(Smi::FromInt(osr_pc_offset_)); | 607 data->SetOsrPcOffset(Smi::FromInt(osr_pc_offset_)); |
| 608 | 608 |
| 609 // Populate the deoptimization entries. | 609 // Populate the deoptimization entries. |
| 610 for (int i = 0; i < length; i++) { | 610 for (int i = 0; i < length; i++) { |
| (...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1895 | 1895 |
| 1896 void LCodeGen::DoInstanceOf(LInstanceOf* instr) { | 1896 void LCodeGen::DoInstanceOf(LInstanceOf* instr) { |
| 1897 ASSERT(ToRegister(instr->InputAt(0)).is(r0)); // Object is in r0. | 1897 ASSERT(ToRegister(instr->InputAt(0)).is(r0)); // Object is in r0. |
| 1898 ASSERT(ToRegister(instr->InputAt(1)).is(r1)); // Function is in r1. | 1898 ASSERT(ToRegister(instr->InputAt(1)).is(r1)); // Function is in r1. |
| 1899 | 1899 |
| 1900 InstanceofStub stub(InstanceofStub::kArgsInRegisters); | 1900 InstanceofStub stub(InstanceofStub::kArgsInRegisters); |
| 1901 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 1901 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 1902 | 1902 |
| 1903 Label true_value, done; | 1903 Label true_value, done; |
| 1904 __ tst(r0, r0); | 1904 __ tst(r0, r0); |
| 1905 __ mov(r0, Operand(FACTORY->false_value()), LeaveCC, ne); | 1905 __ mov(r0, Operand(factory()->false_value()), LeaveCC, ne); |
| 1906 __ mov(r0, Operand(FACTORY->true_value()), LeaveCC, eq); | 1906 __ mov(r0, Operand(factory()->true_value()), LeaveCC, eq); |
| 1907 } | 1907 } |
| 1908 | 1908 |
| 1909 | 1909 |
| 1910 void LCodeGen::DoInstanceOfAndBranch(LInstanceOfAndBranch* instr) { | 1910 void LCodeGen::DoInstanceOfAndBranch(LInstanceOfAndBranch* instr) { |
| 1911 ASSERT(ToRegister(instr->InputAt(0)).is(r0)); // Object is in r0. | 1911 ASSERT(ToRegister(instr->InputAt(0)).is(r0)); // Object is in r0. |
| 1912 ASSERT(ToRegister(instr->InputAt(1)).is(r1)); // Function is in r1. | 1912 ASSERT(ToRegister(instr->InputAt(1)).is(r1)); // Function is in r1. |
| 1913 | 1913 |
| 1914 int true_block = chunk_->LookupDestination(instr->true_block_id()); | 1914 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
| 1915 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 1915 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
| 1916 | 1916 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1955 // This is the inlined call site instanceof cache. The two occurences of the | 1955 // This is the inlined call site instanceof cache. The two occurences of the |
| 1956 // hole value will be patched to the last map/result pair generated by the | 1956 // hole value will be patched to the last map/result pair generated by the |
| 1957 // instanceof stub. | 1957 // instanceof stub. |
| 1958 Label cache_miss; | 1958 Label cache_miss; |
| 1959 Register map = temp; | 1959 Register map = temp; |
| 1960 __ ldr(map, FieldMemOperand(object, HeapObject::kMapOffset)); | 1960 __ ldr(map, FieldMemOperand(object, HeapObject::kMapOffset)); |
| 1961 __ bind(deferred->map_check()); // Label for calculating code patching. | 1961 __ bind(deferred->map_check()); // Label for calculating code patching. |
| 1962 // We use Factory::the_hole_value() on purpose instead of loading from the | 1962 // We use Factory::the_hole_value() on purpose instead of loading from the |
| 1963 // root array to force relocation to be able to later patch with | 1963 // root array to force relocation to be able to later patch with |
| 1964 // the cached map. | 1964 // the cached map. |
| 1965 __ mov(ip, Operand(FACTORY->the_hole_value())); | 1965 __ mov(ip, Operand(factory()->the_hole_value())); |
| 1966 __ cmp(map, Operand(ip)); | 1966 __ cmp(map, Operand(ip)); |
| 1967 __ b(ne, &cache_miss); | 1967 __ b(ne, &cache_miss); |
| 1968 // We use Factory::the_hole_value() on purpose instead of loading from the | 1968 // We use Factory::the_hole_value() on purpose instead of loading from the |
| 1969 // root array to force relocation to be able to later patch | 1969 // root array to force relocation to be able to later patch |
| 1970 // with true or false. | 1970 // with true or false. |
| 1971 __ mov(result, Operand(FACTORY->the_hole_value())); | 1971 __ mov(result, Operand(factory()->the_hole_value())); |
| 1972 __ b(&done); | 1972 __ b(&done); |
| 1973 | 1973 |
| 1974 // The inlined call site cache did not match. Check null and string before | 1974 // The inlined call site cache did not match. Check null and string before |
| 1975 // calling the deferred code. | 1975 // calling the deferred code. |
| 1976 __ bind(&cache_miss); | 1976 __ bind(&cache_miss); |
| 1977 // Null is not instance of anything. | 1977 // Null is not instance of anything. |
| 1978 __ LoadRoot(ip, Heap::kNullValueRootIndex); | 1978 __ LoadRoot(ip, Heap::kNullValueRootIndex); |
| 1979 __ cmp(object, Operand(ip)); | 1979 __ cmp(object, Operand(ip)); |
| 1980 __ b(eq, &false_result); | 1980 __ b(eq, &false_result); |
| 1981 | 1981 |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2175 } | 2175 } |
| 2176 | 2176 |
| 2177 | 2177 |
| 2178 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { | 2178 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { |
| 2179 ASSERT(ToRegister(instr->object()).is(r0)); | 2179 ASSERT(ToRegister(instr->object()).is(r0)); |
| 2180 ASSERT(ToRegister(instr->result()).is(r0)); | 2180 ASSERT(ToRegister(instr->result()).is(r0)); |
| 2181 | 2181 |
| 2182 // Name is always in r2. | 2182 // Name is always in r2. |
| 2183 __ mov(r2, Operand(instr->name())); | 2183 __ mov(r2, Operand(instr->name())); |
| 2184 Handle<Code> ic( | 2184 Handle<Code> ic( |
| 2185 Isolate::Current()->builtins()->builtin(Builtins::LoadIC_Initialize)); | 2185 isolate()->builtins()->builtin(Builtins::LoadIC_Initialize)); |
| 2186 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2186 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 2187 } | 2187 } |
| 2188 | 2188 |
| 2189 | 2189 |
| 2190 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { | 2190 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { |
| 2191 Register scratch = scratch0(); | 2191 Register scratch = scratch0(); |
| 2192 Register function = ToRegister(instr->function()); | 2192 Register function = ToRegister(instr->function()); |
| 2193 Register result = ToRegister(instr->result()); | 2193 Register result = ToRegister(instr->result()); |
| 2194 | 2194 |
| 2195 // Check that the function really is a function. Load map into the | 2195 // Check that the function really is a function. Load map into the |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2306 | 2306 |
| 2307 // Load the result. | 2307 // Load the result. |
| 2308 __ ldrb(result, MemOperand(external_pointer, key)); | 2308 __ ldrb(result, MemOperand(external_pointer, key)); |
| 2309 } | 2309 } |
| 2310 | 2310 |
| 2311 | 2311 |
| 2312 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { | 2312 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { |
| 2313 ASSERT(ToRegister(instr->object()).is(r1)); | 2313 ASSERT(ToRegister(instr->object()).is(r1)); |
| 2314 ASSERT(ToRegister(instr->key()).is(r0)); | 2314 ASSERT(ToRegister(instr->key()).is(r0)); |
| 2315 | 2315 |
| 2316 Handle<Code> ic(Isolate::Current()->builtins()-> | 2316 Handle<Code> ic(isolate()->builtins()->builtin( |
| 2317 builtin(Builtins::KeyedLoadIC_Initialize)); | 2317 Builtins::KeyedLoadIC_Initialize)); |
| 2318 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2318 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 2319 } | 2319 } |
| 2320 | 2320 |
| 2321 | 2321 |
| 2322 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) { | 2322 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) { |
| 2323 Register scratch = scratch0(); | 2323 Register scratch = scratch0(); |
| 2324 Register result = ToRegister(instr->result()); | 2324 Register result = ToRegister(instr->result()); |
| 2325 | 2325 |
| 2326 // Check if the calling frame is an arguments adaptor frame. | 2326 // Check if the calling frame is an arguments adaptor frame. |
| 2327 Label done, adapted; | 2327 Label done, adapted; |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2813 UNREACHABLE(); | 2813 UNREACHABLE(); |
| 2814 } | 2814 } |
| 2815 } | 2815 } |
| 2816 | 2816 |
| 2817 | 2817 |
| 2818 void LCodeGen::DoCallKeyed(LCallKeyed* instr) { | 2818 void LCodeGen::DoCallKeyed(LCallKeyed* instr) { |
| 2819 ASSERT(ToRegister(instr->result()).is(r0)); | 2819 ASSERT(ToRegister(instr->result()).is(r0)); |
| 2820 | 2820 |
| 2821 int arity = instr->arity(); | 2821 int arity = instr->arity(); |
| 2822 Handle<Code> ic = | 2822 Handle<Code> ic = |
| 2823 Isolate::Current()->stub_cache()->ComputeKeyedCallInitialize(arity, | 2823 isolate()->stub_cache()->ComputeKeyedCallInitialize(arity, NOT_IN_LOOP); |
| 2824 NOT_IN_LOOP); | |
| 2825 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2824 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 2826 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2825 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 2827 } | 2826 } |
| 2828 | 2827 |
| 2829 | 2828 |
| 2830 void LCodeGen::DoCallNamed(LCallNamed* instr) { | 2829 void LCodeGen::DoCallNamed(LCallNamed* instr) { |
| 2831 ASSERT(ToRegister(instr->result()).is(r0)); | 2830 ASSERT(ToRegister(instr->result()).is(r0)); |
| 2832 | 2831 |
| 2833 int arity = instr->arity(); | 2832 int arity = instr->arity(); |
| 2834 Handle<Code> ic = Isolate::Current()->stub_cache()-> | 2833 Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize( |
| 2835 ComputeCallInitialize(arity, NOT_IN_LOOP); | 2834 arity, NOT_IN_LOOP); |
| 2836 __ mov(r2, Operand(instr->name())); | 2835 __ mov(r2, Operand(instr->name())); |
| 2837 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2836 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 2838 // Restore context register. | 2837 // Restore context register. |
| 2839 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2838 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 2840 } | 2839 } |
| 2841 | 2840 |
| 2842 | 2841 |
| 2843 void LCodeGen::DoCallFunction(LCallFunction* instr) { | 2842 void LCodeGen::DoCallFunction(LCallFunction* instr) { |
| 2844 ASSERT(ToRegister(instr->result()).is(r0)); | 2843 ASSERT(ToRegister(instr->result()).is(r0)); |
| 2845 | 2844 |
| 2846 int arity = instr->arity(); | 2845 int arity = instr->arity(); |
| 2847 CallFunctionStub stub(arity, NOT_IN_LOOP, RECEIVER_MIGHT_BE_VALUE); | 2846 CallFunctionStub stub(arity, NOT_IN_LOOP, RECEIVER_MIGHT_BE_VALUE); |
| 2848 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 2847 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 2849 __ Drop(1); | 2848 __ Drop(1); |
| 2850 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2849 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 2851 } | 2850 } |
| 2852 | 2851 |
| 2853 | 2852 |
| 2854 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { | 2853 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { |
| 2855 ASSERT(ToRegister(instr->result()).is(r0)); | 2854 ASSERT(ToRegister(instr->result()).is(r0)); |
| 2856 | 2855 |
| 2857 int arity = instr->arity(); | 2856 int arity = instr->arity(); |
| 2858 Handle<Code> ic = | 2857 Handle<Code> ic = |
| 2859 Isolate::Current()->stub_cache()->ComputeCallInitialize(arity, | 2858 isolate()->stub_cache()->ComputeCallInitialize(arity, NOT_IN_LOOP); |
| 2860 NOT_IN_LOOP); | |
| 2861 __ mov(r2, Operand(instr->name())); | 2859 __ mov(r2, Operand(instr->name())); |
| 2862 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr); | 2860 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr); |
| 2863 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2861 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 2864 } | 2862 } |
| 2865 | 2863 |
| 2866 | 2864 |
| 2867 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) { | 2865 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) { |
| 2868 ASSERT(ToRegister(instr->result()).is(r0)); | 2866 ASSERT(ToRegister(instr->result()).is(r0)); |
| 2869 __ mov(r1, Operand(instr->target())); | 2867 __ mov(r1, Operand(instr->target())); |
| 2870 CallKnownFunction(instr->target(), instr->arity(), instr); | 2868 CallKnownFunction(instr->target(), instr->arity(), instr); |
| 2871 } | 2869 } |
| 2872 | 2870 |
| 2873 | 2871 |
| 2874 void LCodeGen::DoCallNew(LCallNew* instr) { | 2872 void LCodeGen::DoCallNew(LCallNew* instr) { |
| 2875 ASSERT(ToRegister(instr->InputAt(0)).is(r1)); | 2873 ASSERT(ToRegister(instr->InputAt(0)).is(r1)); |
| 2876 ASSERT(ToRegister(instr->result()).is(r0)); | 2874 ASSERT(ToRegister(instr->result()).is(r0)); |
| 2877 | 2875 |
| 2878 Handle<Code> builtin(Isolate::Current()->builtins()-> | 2876 Handle<Code> builtin(isolate()->builtins()->builtin( |
| 2879 builtin(Builtins::JSConstructCall)); | 2877 Builtins::JSConstructCall)); |
| 2880 __ mov(r0, Operand(instr->arity())); | 2878 __ mov(r0, Operand(instr->arity())); |
| 2881 CallCode(builtin, RelocInfo::CONSTRUCT_CALL, instr); | 2879 CallCode(builtin, RelocInfo::CONSTRUCT_CALL, instr); |
| 2882 } | 2880 } |
| 2883 | 2881 |
| 2884 | 2882 |
| 2885 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { | 2883 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { |
| 2886 CallRuntime(instr->function(), instr->arity(), instr); | 2884 CallRuntime(instr->function(), instr->arity(), instr); |
| 2887 } | 2885 } |
| 2888 | 2886 |
| 2889 | 2887 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 2918 } | 2916 } |
| 2919 } | 2917 } |
| 2920 | 2918 |
| 2921 | 2919 |
| 2922 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { | 2920 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
| 2923 ASSERT(ToRegister(instr->object()).is(r1)); | 2921 ASSERT(ToRegister(instr->object()).is(r1)); |
| 2924 ASSERT(ToRegister(instr->value()).is(r0)); | 2922 ASSERT(ToRegister(instr->value()).is(r0)); |
| 2925 | 2923 |
| 2926 // Name is always in r2. | 2924 // Name is always in r2. |
| 2927 __ mov(r2, Operand(instr->name())); | 2925 __ mov(r2, Operand(instr->name())); |
| 2928 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 2926 Handle<Code> ic(isolate()->builtins()->builtin( |
| 2929 info_->is_strict() ? Builtins::StoreIC_Initialize_Strict | 2927 info_->is_strict() ? Builtins::StoreIC_Initialize_Strict |
| 2930 : Builtins::StoreIC_Initialize)); | 2928 : Builtins::StoreIC_Initialize)); |
| 2931 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2929 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 2932 } | 2930 } |
| 2933 | 2931 |
| 2934 | 2932 |
| 2935 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 2933 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
| 2936 __ cmp(ToRegister(instr->index()), ToRegister(instr->length())); | 2934 __ cmp(ToRegister(instr->index()), ToRegister(instr->length())); |
| 2937 DeoptimizeIf(hs, instr->environment()); | 2935 DeoptimizeIf(hs, instr->environment()); |
| 2938 } | 2936 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2973 __ Usat(value, 8, Operand(value)); | 2971 __ Usat(value, 8, Operand(value)); |
| 2974 __ strb(value, MemOperand(external_pointer, key, LSL, 0)); | 2972 __ strb(value, MemOperand(external_pointer, key, LSL, 0)); |
| 2975 } | 2973 } |
| 2976 | 2974 |
| 2977 | 2975 |
| 2978 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 2976 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
| 2979 ASSERT(ToRegister(instr->object()).is(r2)); | 2977 ASSERT(ToRegister(instr->object()).is(r2)); |
| 2980 ASSERT(ToRegister(instr->key()).is(r1)); | 2978 ASSERT(ToRegister(instr->key()).is(r1)); |
| 2981 ASSERT(ToRegister(instr->value()).is(r0)); | 2979 ASSERT(ToRegister(instr->value()).is(r0)); |
| 2982 | 2980 |
| 2983 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 2981 Handle<Code> ic(isolate()->builtins()->builtin( |
| 2984 info_->is_strict() ? Builtins::KeyedStoreIC_Initialize_Strict | 2982 info_->is_strict() ? Builtins::KeyedStoreIC_Initialize_Strict |
| 2985 : Builtins::KeyedStoreIC_Initialize)); | 2983 : Builtins::KeyedStoreIC_Initialize)); |
| 2986 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2984 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 2987 } | 2985 } |
| 2988 | 2986 |
| 2989 | 2987 |
| 2990 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) { | 2988 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) { |
| 2991 class DeferredStringCharCodeAt: public LDeferredCode { | 2989 class DeferredStringCharCodeAt: public LDeferredCode { |
| 2992 public: | 2990 public: |
| 2993 DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr) | 2991 DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr) |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3579 ASSERT(input->IsRegister()); | 3577 ASSERT(input->IsRegister()); |
| 3580 Register reg = ToRegister(input); | 3578 Register reg = ToRegister(input); |
| 3581 __ ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset)); | 3579 __ ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset)); |
| 3582 __ cmp(scratch, Operand(instr->hydrogen()->map())); | 3580 __ cmp(scratch, Operand(instr->hydrogen()->map())); |
| 3583 DeoptimizeIf(ne, instr->environment()); | 3581 DeoptimizeIf(ne, instr->environment()); |
| 3584 } | 3582 } |
| 3585 | 3583 |
| 3586 | 3584 |
| 3587 void LCodeGen::LoadHeapObject(Register result, | 3585 void LCodeGen::LoadHeapObject(Register result, |
| 3588 Handle<HeapObject> object) { | 3586 Handle<HeapObject> object) { |
| 3589 if (HEAP->InNewSpace(*object)) { | 3587 if (heap()->InNewSpace(*object)) { |
| 3590 Handle<JSGlobalPropertyCell> cell = | 3588 Handle<JSGlobalPropertyCell> cell = |
| 3591 FACTORY->NewJSGlobalPropertyCell(object); | 3589 factory()->NewJSGlobalPropertyCell(object); |
| 3592 __ mov(result, Operand(cell)); | 3590 __ mov(result, Operand(cell)); |
| 3593 __ ldr(result, FieldMemOperand(result, JSGlobalPropertyCell::kValueOffset)); | 3591 __ ldr(result, FieldMemOperand(result, JSGlobalPropertyCell::kValueOffset)); |
| 3594 } else { | 3592 } else { |
| 3595 __ mov(result, Operand(object)); | 3593 __ mov(result, Operand(object)); |
| 3596 } | 3594 } |
| 3597 } | 3595 } |
| 3598 | 3596 |
| 3599 | 3597 |
| 3600 void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { | 3598 void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { |
| 3601 Register temp1 = ToRegister(instr->TempAt(0)); | 3599 Register temp1 = ToRegister(instr->TempAt(0)); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3731 Handle<SharedFunctionInfo> shared_info = instr->shared_info(); | 3729 Handle<SharedFunctionInfo> shared_info = instr->shared_info(); |
| 3732 bool pretenure = instr->hydrogen()->pretenure(); | 3730 bool pretenure = instr->hydrogen()->pretenure(); |
| 3733 if (shared_info->num_literals() == 0 && !pretenure) { | 3731 if (shared_info->num_literals() == 0 && !pretenure) { |
| 3734 FastNewClosureStub stub; | 3732 FastNewClosureStub stub; |
| 3735 __ mov(r1, Operand(shared_info)); | 3733 __ mov(r1, Operand(shared_info)); |
| 3736 __ push(r1); | 3734 __ push(r1); |
| 3737 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 3735 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 3738 } else { | 3736 } else { |
| 3739 __ mov(r2, Operand(shared_info)); | 3737 __ mov(r2, Operand(shared_info)); |
| 3740 __ mov(r1, Operand(pretenure | 3738 __ mov(r1, Operand(pretenure |
| 3741 ? FACTORY->true_value() | 3739 ? factory()->true_value() |
| 3742 : FACTORY->false_value())); | 3740 : factory()->false_value())); |
| 3743 __ Push(cp, r2, r1); | 3741 __ Push(cp, r2, r1); |
| 3744 CallRuntime(Runtime::kNewClosure, 3, instr); | 3742 CallRuntime(Runtime::kNewClosure, 3, instr); |
| 3745 } | 3743 } |
| 3746 } | 3744 } |
| 3747 | 3745 |
| 3748 | 3746 |
| 3749 void LCodeGen::DoTypeof(LTypeof* instr) { | 3747 void LCodeGen::DoTypeof(LTypeof* instr) { |
| 3750 Register input = ToRegister(instr->InputAt(0)); | 3748 Register input = ToRegister(instr->InputAt(0)); |
| 3751 __ push(input); | 3749 __ push(input); |
| 3752 CallRuntime(Runtime::kTypeof, 1, instr); | 3750 CallRuntime(Runtime::kTypeof, 1, instr); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3791 EmitBranch(true_block, false_block, final_branch_condition); | 3789 EmitBranch(true_block, false_block, final_branch_condition); |
| 3792 } | 3790 } |
| 3793 | 3791 |
| 3794 | 3792 |
| 3795 Condition LCodeGen::EmitTypeofIs(Label* true_label, | 3793 Condition LCodeGen::EmitTypeofIs(Label* true_label, |
| 3796 Label* false_label, | 3794 Label* false_label, |
| 3797 Register input, | 3795 Register input, |
| 3798 Handle<String> type_name) { | 3796 Handle<String> type_name) { |
| 3799 Condition final_branch_condition = kNoCondition; | 3797 Condition final_branch_condition = kNoCondition; |
| 3800 Register scratch = scratch0(); | 3798 Register scratch = scratch0(); |
| 3801 if (type_name->Equals(HEAP->number_symbol())) { | 3799 if (type_name->Equals(heap()->number_symbol())) { |
| 3802 __ JumpIfSmi(input, true_label); | 3800 __ JumpIfSmi(input, true_label); |
| 3803 __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset)); | 3801 __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset)); |
| 3804 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); | 3802 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); |
| 3805 __ cmp(input, Operand(ip)); | 3803 __ cmp(input, Operand(ip)); |
| 3806 final_branch_condition = eq; | 3804 final_branch_condition = eq; |
| 3807 | 3805 |
| 3808 } else if (type_name->Equals(HEAP->string_symbol())) { | 3806 } else if (type_name->Equals(heap()->string_symbol())) { |
| 3809 __ JumpIfSmi(input, false_label); | 3807 __ JumpIfSmi(input, false_label); |
| 3810 __ CompareObjectType(input, input, scratch, FIRST_NONSTRING_TYPE); | 3808 __ CompareObjectType(input, input, scratch, FIRST_NONSTRING_TYPE); |
| 3811 __ b(ge, false_label); | 3809 __ b(ge, false_label); |
| 3812 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); | 3810 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); |
| 3813 __ tst(ip, Operand(1 << Map::kIsUndetectable)); | 3811 __ tst(ip, Operand(1 << Map::kIsUndetectable)); |
| 3814 final_branch_condition = eq; | 3812 final_branch_condition = eq; |
| 3815 | 3813 |
| 3816 } else if (type_name->Equals(HEAP->boolean_symbol())) { | 3814 } else if (type_name->Equals(heap()->boolean_symbol())) { |
| 3817 __ CompareRoot(input, Heap::kTrueValueRootIndex); | 3815 __ CompareRoot(input, Heap::kTrueValueRootIndex); |
| 3818 __ b(eq, true_label); | 3816 __ b(eq, true_label); |
| 3819 __ CompareRoot(input, Heap::kFalseValueRootIndex); | 3817 __ CompareRoot(input, Heap::kFalseValueRootIndex); |
| 3820 final_branch_condition = eq; | 3818 final_branch_condition = eq; |
| 3821 | 3819 |
| 3822 } else if (type_name->Equals(HEAP->undefined_symbol())) { | 3820 } else if (type_name->Equals(heap()->undefined_symbol())) { |
| 3823 __ CompareRoot(input, Heap::kUndefinedValueRootIndex); | 3821 __ CompareRoot(input, Heap::kUndefinedValueRootIndex); |
| 3824 __ b(eq, true_label); | 3822 __ b(eq, true_label); |
| 3825 __ JumpIfSmi(input, false_label); | 3823 __ JumpIfSmi(input, false_label); |
| 3826 // Check for undetectable objects => true. | 3824 // Check for undetectable objects => true. |
| 3827 __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset)); | 3825 __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset)); |
| 3828 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); | 3826 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); |
| 3829 __ tst(ip, Operand(1 << Map::kIsUndetectable)); | 3827 __ tst(ip, Operand(1 << Map::kIsUndetectable)); |
| 3830 final_branch_condition = ne; | 3828 final_branch_condition = ne; |
| 3831 | 3829 |
| 3832 } else if (type_name->Equals(HEAP->function_symbol())) { | 3830 } else if (type_name->Equals(heap()->function_symbol())) { |
| 3833 __ JumpIfSmi(input, false_label); | 3831 __ JumpIfSmi(input, false_label); |
| 3834 __ CompareObjectType(input, input, scratch, FIRST_FUNCTION_CLASS_TYPE); | 3832 __ CompareObjectType(input, input, scratch, FIRST_FUNCTION_CLASS_TYPE); |
| 3835 final_branch_condition = ge; | 3833 final_branch_condition = ge; |
| 3836 | 3834 |
| 3837 } else if (type_name->Equals(HEAP->object_symbol())) { | 3835 } else if (type_name->Equals(heap()->object_symbol())) { |
| 3838 __ JumpIfSmi(input, false_label); | 3836 __ JumpIfSmi(input, false_label); |
| 3839 __ CompareRoot(input, Heap::kNullValueRootIndex); | 3837 __ CompareRoot(input, Heap::kNullValueRootIndex); |
| 3840 __ b(eq, true_label); | 3838 __ b(eq, true_label); |
| 3841 __ CompareObjectType(input, input, scratch, FIRST_JS_OBJECT_TYPE); | 3839 __ CompareObjectType(input, input, scratch, FIRST_JS_OBJECT_TYPE); |
| 3842 __ b(lo, false_label); | 3840 __ b(lo, false_label); |
| 3843 __ CompareInstanceType(input, scratch, FIRST_FUNCTION_CLASS_TYPE); | 3841 __ CompareInstanceType(input, scratch, FIRST_FUNCTION_CLASS_TYPE); |
| 3844 __ b(hs, false_label); | 3842 __ b(hs, false_label); |
| 3845 // Check for undetectable objects => false. | 3843 // Check for undetectable objects => false. |
| 3846 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); | 3844 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); |
| 3847 __ tst(ip, Operand(1 << Map::kIsUndetectable)); | 3845 __ tst(ip, Operand(1 << Map::kIsUndetectable)); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3960 ASSERT(!environment->HasBeenRegistered()); | 3958 ASSERT(!environment->HasBeenRegistered()); |
| 3961 RegisterEnvironmentForDeoptimization(environment); | 3959 RegisterEnvironmentForDeoptimization(environment); |
| 3962 ASSERT(osr_pc_offset_ == -1); | 3960 ASSERT(osr_pc_offset_ == -1); |
| 3963 osr_pc_offset_ = masm()->pc_offset(); | 3961 osr_pc_offset_ = masm()->pc_offset(); |
| 3964 } | 3962 } |
| 3965 | 3963 |
| 3966 | 3964 |
| 3967 #undef __ | 3965 #undef __ |
| 3968 | 3966 |
| 3969 } } // namespace v8::internal | 3967 } } // namespace v8::internal |
| OLD | NEW |