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 4629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4640 // A monomorphic cache hit or an already megamorphic state: invoke the | 4640 // A monomorphic cache hit or an already megamorphic state: invoke the |
4641 // function without changing the state. | 4641 // function without changing the state. |
4642 __ cmp(r3, r1); | 4642 __ cmp(r3, r1); |
4643 __ b(eq, &done); | 4643 __ b(eq, &done); |
4644 __ CompareRoot(r3, Heap::kUndefinedValueRootIndex); | 4644 __ CompareRoot(r3, Heap::kUndefinedValueRootIndex); |
4645 __ b(eq, &done); | 4645 __ b(eq, &done); |
4646 | 4646 |
4647 // Special handling of the Array() function, which caches not only the | 4647 // Special handling of the Array() function, which caches not only the |
4648 // monomorphic Array function but the initial ElementsKind with special | 4648 // monomorphic Array function but the initial ElementsKind with special |
4649 // sentinels | 4649 // sentinels |
4650 Handle<Object> terminal_kind_sentinel = | |
4651 TypeFeedbackCells::MonomorphicArraySentinel(masm->isolate(), | |
4652 LAST_FAST_ELEMENTS_KIND); | |
4653 __ JumpIfNotSmi(r3, &miss); | 4650 __ JumpIfNotSmi(r3, &miss); |
4654 __ cmp(r3, Operand(terminal_kind_sentinel)); | 4651 if (FLAG_debug_code) { |
4655 __ b(gt, &miss); | 4652 Handle<Object> terminal_kind_sentinel = |
| 4653 TypeFeedbackCells::MonomorphicArraySentinel(masm->isolate(), |
| 4654 LAST_FAST_ELEMENTS_KIND); |
| 4655 __ cmp(r3, Operand(terminal_kind_sentinel)); |
| 4656 __ Assert(le, "Array function sentinel is not an ElementsKind"); |
| 4657 } |
| 4658 |
4656 // Make sure the function is the Array() function | 4659 // Make sure the function is the Array() function |
4657 __ LoadArrayFunction(r3); | 4660 __ LoadArrayFunction(r3); |
4658 __ cmp(r1, r3); | 4661 __ cmp(r1, r3); |
4659 __ b(ne, &megamorphic); | 4662 __ b(ne, &megamorphic); |
4660 __ jmp(&done); | 4663 __ jmp(&done); |
4661 | 4664 |
4662 __ bind(&miss); | 4665 __ bind(&miss); |
4663 | 4666 |
4664 // A monomorphic miss (i.e, here the cache is not uninitialized) goes | 4667 // A monomorphic miss (i.e, here the cache is not uninitialized) goes |
4665 // megamorphic. | 4668 // megamorphic. |
(...skipping 2519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7185 __ ldr(r5, MemOperand(sp, 0)); | 7188 __ ldr(r5, MemOperand(sp, 0)); |
7186 __ cmp(r5, Operand::Zero()); | 7189 __ cmp(r5, Operand::Zero()); |
7187 __ b(eq, &normal_sequence); | 7190 __ b(eq, &normal_sequence); |
7188 | 7191 |
7189 // We are going to create a holey array, but our kind is non-holey. | 7192 // We are going to create a holey array, but our kind is non-holey. |
7190 // Fix kind and retry | 7193 // Fix kind and retry |
7191 __ add(r3, r3, Operand(1)); | 7194 __ add(r3, r3, Operand(1)); |
7192 __ cmp(r2, Operand(undefined_sentinel)); | 7195 __ cmp(r2, Operand(undefined_sentinel)); |
7193 __ b(eq, &normal_sequence); | 7196 __ b(eq, &normal_sequence); |
7194 | 7197 |
| 7198 // The type cell may have gone megamorphic, don't overwrite if so |
| 7199 __ ldr(r5, FieldMemOperand(r2, kPointerSize)); |
| 7200 __ JumpIfNotSmi(r5, &normal_sequence); |
| 7201 |
7195 // Save the resulting elements kind in type info | 7202 // Save the resulting elements kind in type info |
7196 __ SmiTag(r3); | 7203 __ SmiTag(r3); |
7197 __ str(r3, FieldMemOperand(r2, kPointerSize)); | 7204 __ str(r3, FieldMemOperand(r2, kPointerSize)); |
7198 __ SmiUntag(r3); | 7205 __ SmiUntag(r3); |
7199 | 7206 |
7200 __ bind(&normal_sequence); | 7207 __ bind(&normal_sequence); |
7201 int last_index = GetSequenceIndexFromFastElementsKind( | 7208 int last_index = GetSequenceIndexFromFastElementsKind( |
7202 TERMINAL_FAST_ELEMENTS_KIND); | 7209 TERMINAL_FAST_ELEMENTS_KIND); |
7203 for (int i = 0; i <= last_index; ++i) { | 7210 for (int i = 0; i <= last_index; ++i) { |
7204 Label next; | 7211 Label next; |
(...skipping 12 matching lines...) Expand all Loading... |
7217 | 7224 |
7218 template<class T> | 7225 template<class T> |
7219 static void ArrayConstructorStubAheadOfTimeHelper(Isolate* isolate) { | 7226 static void ArrayConstructorStubAheadOfTimeHelper(Isolate* isolate) { |
7220 int to_index = GetSequenceIndexFromFastElementsKind( | 7227 int to_index = GetSequenceIndexFromFastElementsKind( |
7221 TERMINAL_FAST_ELEMENTS_KIND); | 7228 TERMINAL_FAST_ELEMENTS_KIND); |
7222 for (int i = 0; i <= to_index; ++i) { | 7229 for (int i = 0; i <= to_index; ++i) { |
7223 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); | 7230 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); |
7224 T stub(kind); | 7231 T stub(kind); |
7225 stub.GetCode(isolate)->set_is_pregenerated(true); | 7232 stub.GetCode(isolate)->set_is_pregenerated(true); |
7226 if (AllocationSiteInfo::GetMode(kind) != DONT_TRACK_ALLOCATION_SITE) { | 7233 if (AllocationSiteInfo::GetMode(kind) != DONT_TRACK_ALLOCATION_SITE) { |
7227 T stub1(kind, true); | 7234 T stub1(kind, CONTEXT_CHECK_REQUIRED, DISABLE_ALLOCATION_SITES); |
7228 stub1.GetCode(isolate)->set_is_pregenerated(true); | 7235 stub1.GetCode(isolate)->set_is_pregenerated(true); |
7229 } | 7236 } |
7230 } | 7237 } |
7231 } | 7238 } |
7232 | 7239 |
7233 | 7240 |
7234 void ArrayConstructorStubBase::GenerateStubsAheadOfTime(Isolate* isolate) { | 7241 void ArrayConstructorStubBase::GenerateStubsAheadOfTime(Isolate* isolate) { |
7235 ArrayConstructorStubAheadOfTimeHelper<ArrayNoArgumentConstructorStub>( | 7242 ArrayConstructorStubAheadOfTimeHelper<ArrayNoArgumentConstructorStub>( |
7236 isolate); | 7243 isolate); |
7237 ArrayConstructorStubAheadOfTimeHelper<ArraySingleArgumentConstructorStub>( | 7244 ArrayConstructorStubAheadOfTimeHelper<ArraySingleArgumentConstructorStub>( |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7411 __ bind(&fast_elements_case); | 7418 __ bind(&fast_elements_case); |
7412 GenerateCase(masm, FAST_ELEMENTS); | 7419 GenerateCase(masm, FAST_ELEMENTS); |
7413 } | 7420 } |
7414 | 7421 |
7415 | 7422 |
7416 #undef __ | 7423 #undef __ |
7417 | 7424 |
7418 } } // namespace v8::internal | 7425 } } // namespace v8::internal |
7419 | 7426 |
7420 #endif // V8_TARGET_ARCH_ARM | 7427 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |