| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if V8_TARGET_ARCH_ARM | 5 #if V8_TARGET_ARCH_ARM |
| 6 | 6 |
| 7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 2298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2309 Label check_allocation_site; | 2309 Label check_allocation_site; |
| 2310 Register feedback_map = r6; | 2310 Register feedback_map = r6; |
| 2311 Register weak_value = r9; | 2311 Register weak_value = r9; |
| 2312 __ ldr(weak_value, FieldMemOperand(r5, WeakCell::kValueOffset)); | 2312 __ ldr(weak_value, FieldMemOperand(r5, WeakCell::kValueOffset)); |
| 2313 __ cmp(r1, weak_value); | 2313 __ cmp(r1, weak_value); |
| 2314 __ b(eq, &done); | 2314 __ b(eq, &done); |
| 2315 __ CompareRoot(r5, Heap::kmegamorphic_symbolRootIndex); | 2315 __ CompareRoot(r5, Heap::kmegamorphic_symbolRootIndex); |
| 2316 __ b(eq, &done); | 2316 __ b(eq, &done); |
| 2317 __ ldr(feedback_map, FieldMemOperand(r5, HeapObject::kMapOffset)); | 2317 __ ldr(feedback_map, FieldMemOperand(r5, HeapObject::kMapOffset)); |
| 2318 __ CompareRoot(feedback_map, Heap::kWeakCellMapRootIndex); | 2318 __ CompareRoot(feedback_map, Heap::kWeakCellMapRootIndex); |
| 2319 __ b(ne, FLAG_pretenuring_call_new ? &miss : &check_allocation_site); | 2319 __ b(ne, &check_allocation_site); |
| 2320 | 2320 |
| 2321 // If the weak cell is cleared, we have a new chance to become monomorphic. | 2321 // If the weak cell is cleared, we have a new chance to become monomorphic. |
| 2322 __ JumpIfSmi(weak_value, &initialize); | 2322 __ JumpIfSmi(weak_value, &initialize); |
| 2323 __ jmp(&megamorphic); | 2323 __ jmp(&megamorphic); |
| 2324 | 2324 |
| 2325 if (!FLAG_pretenuring_call_new) { | 2325 __ bind(&check_allocation_site); |
| 2326 __ bind(&check_allocation_site); | 2326 // If we came here, we need to see if we are the array function. |
| 2327 // If we came here, we need to see if we are the array function. | 2327 // If we didn't have a matching function, and we didn't find the megamorph |
| 2328 // If we didn't have a matching function, and we didn't find the megamorph | 2328 // sentinel, then we have in the slot either some other function or an |
| 2329 // sentinel, then we have in the slot either some other function or an | 2329 // AllocationSite. |
| 2330 // AllocationSite. | 2330 __ CompareRoot(feedback_map, Heap::kAllocationSiteMapRootIndex); |
| 2331 __ CompareRoot(feedback_map, Heap::kAllocationSiteMapRootIndex); | 2331 __ b(ne, &miss); |
| 2332 __ b(ne, &miss); | |
| 2333 | 2332 |
| 2334 // Make sure the function is the Array() function | 2333 // Make sure the function is the Array() function |
| 2335 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r5); | 2334 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r5); |
| 2336 __ cmp(r1, r5); | 2335 __ cmp(r1, r5); |
| 2337 __ b(ne, &megamorphic); | 2336 __ b(ne, &megamorphic); |
| 2338 __ jmp(&done); | 2337 __ jmp(&done); |
| 2339 } | |
| 2340 | 2338 |
| 2341 __ bind(&miss); | 2339 __ bind(&miss); |
| 2342 | 2340 |
| 2343 // A monomorphic miss (i.e, here the cache is not uninitialized) goes | 2341 // A monomorphic miss (i.e, here the cache is not uninitialized) goes |
| 2344 // megamorphic. | 2342 // megamorphic. |
| 2345 __ CompareRoot(r5, Heap::kuninitialized_symbolRootIndex); | 2343 __ CompareRoot(r5, Heap::kuninitialized_symbolRootIndex); |
| 2346 __ b(eq, &initialize); | 2344 __ b(eq, &initialize); |
| 2347 // MegamorphicSentinel is an immortal immovable object (undefined) so no | 2345 // MegamorphicSentinel is an immortal immovable object (undefined) so no |
| 2348 // write-barrier is needed. | 2346 // write-barrier is needed. |
| 2349 __ bind(&megamorphic); | 2347 __ bind(&megamorphic); |
| 2350 __ add(r5, r2, Operand::PointerOffsetFromSmiKey(r3)); | 2348 __ add(r5, r2, Operand::PointerOffsetFromSmiKey(r3)); |
| 2351 __ LoadRoot(ip, Heap::kmegamorphic_symbolRootIndex); | 2349 __ LoadRoot(ip, Heap::kmegamorphic_symbolRootIndex); |
| 2352 __ str(ip, FieldMemOperand(r5, FixedArray::kHeaderSize)); | 2350 __ str(ip, FieldMemOperand(r5, FixedArray::kHeaderSize)); |
| 2353 __ jmp(&done); | 2351 __ jmp(&done); |
| 2354 | 2352 |
| 2355 // An uninitialized cache is patched with the function | 2353 // An uninitialized cache is patched with the function |
| 2356 __ bind(&initialize); | 2354 __ bind(&initialize); |
| 2357 | 2355 |
| 2358 if (!FLAG_pretenuring_call_new) { | 2356 // Make sure the function is the Array() function |
| 2359 // Make sure the function is the Array() function | 2357 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r5); |
| 2360 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r5); | 2358 __ cmp(r1, r5); |
| 2361 __ cmp(r1, r5); | 2359 __ b(ne, ¬_array_function); |
| 2362 __ b(ne, ¬_array_function); | |
| 2363 | 2360 |
| 2364 // The target function is the Array constructor, | 2361 // The target function is the Array constructor, |
| 2365 // Create an AllocationSite if we don't already have it, store it in the | 2362 // Create an AllocationSite if we don't already have it, store it in the |
| 2366 // slot. | 2363 // slot. |
| 2367 CreateAllocationSiteStub create_stub(masm->isolate()); | 2364 CreateAllocationSiteStub create_stub(masm->isolate()); |
| 2368 CallStubInRecordCallTarget(masm, &create_stub, is_super); | 2365 CallStubInRecordCallTarget(masm, &create_stub, is_super); |
| 2369 __ b(&done); | 2366 __ b(&done); |
| 2370 | 2367 |
| 2371 __ bind(¬_array_function); | 2368 __ bind(¬_array_function); |
| 2372 } | 2369 CreateWeakCellStub weak_cell_stub(masm->isolate()); |
| 2373 | 2370 CallStubInRecordCallTarget(masm, &weak_cell_stub, is_super); |
| 2374 CreateWeakCellStub create_stub(masm->isolate()); | |
| 2375 CallStubInRecordCallTarget(masm, &create_stub, is_super); | |
| 2376 __ bind(&done); | 2371 __ bind(&done); |
| 2377 } | 2372 } |
| 2378 | 2373 |
| 2379 | 2374 |
| 2380 static void EmitContinueIfStrictOrNative(MacroAssembler* masm, Label* cont) { | 2375 static void EmitContinueIfStrictOrNative(MacroAssembler* masm, Label* cont) { |
| 2381 // Do not transform the receiver for strict mode functions. | 2376 // Do not transform the receiver for strict mode functions. |
| 2382 __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | 2377 __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
| 2383 __ ldr(r4, FieldMemOperand(r3, SharedFunctionInfo::kCompilerHintsOffset)); | 2378 __ ldr(r4, FieldMemOperand(r3, SharedFunctionInfo::kCompilerHintsOffset)); |
| 2384 __ tst(r4, Operand(1 << (SharedFunctionInfo::kStrictModeFunction + | 2379 __ tst(r4, Operand(1 << (SharedFunctionInfo::kStrictModeFunction + |
| 2385 kSmiTagSize))); | 2380 kSmiTagSize))); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2481 // Check that the function is not a smi. | 2476 // Check that the function is not a smi. |
| 2482 __ JumpIfSmi(r1, &non_function_call); | 2477 __ JumpIfSmi(r1, &non_function_call); |
| 2483 // Check that the function is a JSFunction. | 2478 // Check that the function is a JSFunction. |
| 2484 __ CompareObjectType(r1, r5, r5, JS_FUNCTION_TYPE); | 2479 __ CompareObjectType(r1, r5, r5, JS_FUNCTION_TYPE); |
| 2485 __ b(ne, &slow); | 2480 __ b(ne, &slow); |
| 2486 | 2481 |
| 2487 if (RecordCallTarget()) { | 2482 if (RecordCallTarget()) { |
| 2488 GenerateRecordCallTarget(masm, IsSuperConstructorCall()); | 2483 GenerateRecordCallTarget(masm, IsSuperConstructorCall()); |
| 2489 | 2484 |
| 2490 __ add(r5, r2, Operand::PointerOffsetFromSmiKey(r3)); | 2485 __ add(r5, r2, Operand::PointerOffsetFromSmiKey(r3)); |
| 2491 if (FLAG_pretenuring_call_new) { | 2486 Label feedback_register_initialized; |
| 2492 // Put the AllocationSite from the feedback vector into r2. | 2487 // Put the AllocationSite from the feedback vector into r2, or undefined. |
| 2493 // By adding kPointerSize we encode that we know the AllocationSite | 2488 __ ldr(r2, FieldMemOperand(r5, FixedArray::kHeaderSize)); |
| 2494 // entry is at the feedback vector slot given by r3 + 1. | 2489 __ ldr(r5, FieldMemOperand(r2, AllocationSite::kMapOffset)); |
| 2495 __ ldr(r2, FieldMemOperand(r5, FixedArray::kHeaderSize + kPointerSize)); | 2490 __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex); |
| 2496 } else { | 2491 __ b(eq, &feedback_register_initialized); |
| 2497 Label feedback_register_initialized; | 2492 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); |
| 2498 // Put the AllocationSite from the feedback vector into r2, or undefined. | 2493 __ bind(&feedback_register_initialized); |
| 2499 __ ldr(r2, FieldMemOperand(r5, FixedArray::kHeaderSize)); | |
| 2500 __ ldr(r5, FieldMemOperand(r2, AllocationSite::kMapOffset)); | |
| 2501 __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex); | |
| 2502 __ b(eq, &feedback_register_initialized); | |
| 2503 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); | |
| 2504 __ bind(&feedback_register_initialized); | |
| 2505 } | |
| 2506 | 2494 |
| 2507 __ AssertUndefinedOrAllocationSite(r2, r5); | 2495 __ AssertUndefinedOrAllocationSite(r2, r5); |
| 2508 } | 2496 } |
| 2509 | 2497 |
| 2510 // Pass function as original constructor. | 2498 // Pass function as original constructor. |
| 2511 if (IsSuperConstructorCall()) { | 2499 if (IsSuperConstructorCall()) { |
| 2512 __ mov(r3, r4); | 2500 __ mov(r3, r4); |
| 2513 } else { | 2501 } else { |
| 2514 __ mov(r3, r1); | 2502 __ mov(r3, r1); |
| 2515 } | 2503 } |
| (...skipping 3035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5551 MemOperand(fp, 6 * kPointerSize), NULL); | 5539 MemOperand(fp, 6 * kPointerSize), NULL); |
| 5552 } | 5540 } |
| 5553 | 5541 |
| 5554 | 5542 |
| 5555 #undef __ | 5543 #undef __ |
| 5556 | 5544 |
| 5557 } // namespace internal | 5545 } // namespace internal |
| 5558 } // namespace v8 | 5546 } // namespace v8 |
| 5559 | 5547 |
| 5560 #endif // V8_TARGET_ARCH_ARM | 5548 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |