| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 descriptor->register_param_count_ = 4; | 103 descriptor->register_param_count_ = 4; |
| 104 descriptor->register_params_ = registers; | 104 descriptor->register_params_ = registers; |
| 105 descriptor->deoptimization_handler_ = | 105 descriptor->deoptimization_handler_ = |
| 106 Runtime::FunctionForId(Runtime::kCreateObjectLiteral)->entry; | 106 Runtime::FunctionForId(Runtime::kCreateObjectLiteral)->entry; |
| 107 } | 107 } |
| 108 | 108 |
| 109 | 109 |
| 110 void CreateAllocationSiteStub::InitializeInterfaceDescriptor( | 110 void CreateAllocationSiteStub::InitializeInterfaceDescriptor( |
| 111 Isolate* isolate, | 111 Isolate* isolate, |
| 112 CodeStubInterfaceDescriptor* descriptor) { | 112 CodeStubInterfaceDescriptor* descriptor) { |
| 113 static Register registers[] = { ebx, edx }; | 113 static Register registers[] = { ebx }; |
| 114 descriptor->register_param_count_ = 2; | 114 descriptor->register_param_count_ = 1; |
| 115 descriptor->register_params_ = registers; | 115 descriptor->register_params_ = registers; |
| 116 descriptor->deoptimization_handler_ = NULL; | 116 descriptor->deoptimization_handler_ = NULL; |
| 117 } | 117 } |
| 118 | 118 |
| 119 | 119 |
| 120 void KeyedLoadFastElementStub::InitializeInterfaceDescriptor( | 120 void KeyedLoadFastElementStub::InitializeInterfaceDescriptor( |
| 121 Isolate* isolate, | 121 Isolate* isolate, |
| 122 CodeStubInterfaceDescriptor* descriptor) { | 122 CodeStubInterfaceDescriptor* descriptor) { |
| 123 static Register registers[] = { edx, ecx }; | 123 static Register registers[] = { edx, ecx }; |
| 124 descriptor->register_param_count_ = 2; | 124 descriptor->register_param_count_ = 2; |
| (...skipping 2190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2315 // Call the native; it returns -1 (less), 0 (equal), or 1 (greater) | 2315 // Call the native; it returns -1 (less), 0 (equal), or 1 (greater) |
| 2316 // tagged as a small integer. | 2316 // tagged as a small integer. |
| 2317 __ InvokeBuiltin(builtin, JUMP_FUNCTION); | 2317 __ InvokeBuiltin(builtin, JUMP_FUNCTION); |
| 2318 | 2318 |
| 2319 __ bind(&miss); | 2319 __ bind(&miss); |
| 2320 GenerateMiss(masm); | 2320 GenerateMiss(masm); |
| 2321 } | 2321 } |
| 2322 | 2322 |
| 2323 | 2323 |
| 2324 static void GenerateRecordCallTarget(MacroAssembler* masm) { | 2324 static void GenerateRecordCallTarget(MacroAssembler* masm) { |
| 2325 // Cache the called function in a feedback vector slot. Cache states | 2325 // Cache the called function in a global property cell. Cache states |
| 2326 // are uninitialized, monomorphic (indicated by a JSFunction), and | 2326 // are uninitialized, monomorphic (indicated by a JSFunction), and |
| 2327 // megamorphic. | 2327 // megamorphic. |
| 2328 // eax : number of arguments to the construct function | 2328 // eax : number of arguments to the construct function |
| 2329 // ebx : Feedback vector | 2329 // ebx : cache cell for call target |
| 2330 // edx : slot in feedback vector (Smi) | |
| 2331 // edi : the function to call | 2330 // edi : the function to call |
| 2332 Isolate* isolate = masm->isolate(); | 2331 Isolate* isolate = masm->isolate(); |
| 2333 Label initialize, done, miss, megamorphic, not_array_function; | 2332 Label initialize, done, miss, megamorphic, not_array_function; |
| 2334 | 2333 |
| 2335 // Load the cache state into ecx. | 2334 // Load the cache state into ecx. |
| 2336 __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, | 2335 __ mov(ecx, FieldOperand(ebx, Cell::kValueOffset)); |
| 2337 FixedArray::kHeaderSize)); | |
| 2338 | 2336 |
| 2339 // A monomorphic cache hit or an already megamorphic state: invoke the | 2337 // A monomorphic cache hit or an already megamorphic state: invoke the |
| 2340 // function without changing the state. | 2338 // function without changing the state. |
| 2341 __ cmp(ecx, edi); | 2339 __ cmp(ecx, edi); |
| 2342 __ j(equal, &done, Label::kFar); | 2340 __ j(equal, &done); |
| 2343 __ cmp(ecx, Immediate(TypeFeedbackInfo::MegamorphicSentinel(isolate))); | 2341 __ cmp(ecx, Immediate(TypeFeedbackCells::MegamorphicSentinel(isolate))); |
| 2344 __ j(equal, &done, Label::kFar); | 2342 __ j(equal, &done); |
| 2345 | 2343 |
| 2346 // If we came here, we need to see if we are the array function. | 2344 // If we came here, we need to see if we are the array function. |
| 2347 // If we didn't have a matching function, and we didn't find the megamorph | 2345 // If we didn't have a matching function, and we didn't find the megamorph |
| 2348 // sentinel, then we have in the slot either some other function or an | 2346 // sentinel, then we have in the cell either some other function or an |
| 2349 // AllocationSite. Do a map check on the object in ecx. | 2347 // AllocationSite. Do a map check on the object in ecx. |
| 2350 Handle<Map> allocation_site_map = | 2348 Handle<Map> allocation_site_map = |
| 2351 masm->isolate()->factory()->allocation_site_map(); | 2349 masm->isolate()->factory()->allocation_site_map(); |
| 2352 __ cmp(FieldOperand(ecx, 0), Immediate(allocation_site_map)); | 2350 __ cmp(FieldOperand(ecx, 0), Immediate(allocation_site_map)); |
| 2353 __ j(not_equal, &miss); | 2351 __ j(not_equal, &miss); |
| 2354 | 2352 |
| 2355 // Load the global or builtins object from the current context | 2353 // Load the global or builtins object from the current context |
| 2356 __ LoadGlobalContext(ecx); | 2354 __ LoadGlobalContext(ecx); |
| 2357 // Make sure the function is the Array() function | 2355 // Make sure the function is the Array() function |
| 2358 __ cmp(edi, Operand(ecx, | 2356 __ cmp(edi, Operand(ecx, |
| 2359 Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX))); | 2357 Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX))); |
| 2360 __ j(not_equal, &megamorphic); | 2358 __ j(not_equal, &megamorphic); |
| 2361 __ jmp(&done, Label::kFar); | 2359 __ jmp(&done); |
| 2362 | 2360 |
| 2363 __ bind(&miss); | 2361 __ bind(&miss); |
| 2364 | 2362 |
| 2365 // A monomorphic miss (i.e, here the cache is not uninitialized) goes | 2363 // A monomorphic miss (i.e, here the cache is not uninitialized) goes |
| 2366 // megamorphic. | 2364 // megamorphic. |
| 2367 __ cmp(ecx, Immediate(TypeFeedbackInfo::UninitializedSentinel(isolate))); | 2365 __ cmp(ecx, Immediate(TypeFeedbackCells::UninitializedSentinel(isolate))); |
| 2368 __ j(equal, &initialize); | 2366 __ j(equal, &initialize); |
| 2369 // MegamorphicSentinel is an immortal immovable object (undefined) so no | 2367 // MegamorphicSentinel is an immortal immovable object (undefined) so no |
| 2370 // write-barrier is needed. | 2368 // write-barrier is needed. |
| 2371 __ bind(&megamorphic); | 2369 __ bind(&megamorphic); |
| 2372 __ mov(FieldOperand(ebx, edx, times_half_pointer_size, | 2370 __ mov(FieldOperand(ebx, Cell::kValueOffset), |
| 2373 FixedArray::kHeaderSize), | 2371 Immediate(TypeFeedbackCells::MegamorphicSentinel(isolate))); |
| 2374 Immediate(TypeFeedbackInfo::MegamorphicSentinel(isolate))); | 2372 __ jmp(&done, Label::kNear); |
| 2375 __ jmp(&done, Label::kFar); | |
| 2376 | 2373 |
| 2377 // An uninitialized cache is patched with the function or sentinel to | 2374 // An uninitialized cache is patched with the function or sentinel to |
| 2378 // indicate the ElementsKind if function is the Array constructor. | 2375 // indicate the ElementsKind if function is the Array constructor. |
| 2379 __ bind(&initialize); | 2376 __ bind(&initialize); |
| 2380 __ LoadGlobalContext(ecx); | 2377 __ LoadGlobalContext(ecx); |
| 2381 // Make sure the function is the Array() function | 2378 // Make sure the function is the Array() function |
| 2382 __ cmp(edi, Operand(ecx, | 2379 __ cmp(edi, Operand(ecx, |
| 2383 Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX))); | 2380 Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX))); |
| 2384 __ j(not_equal, ¬_array_function); | 2381 __ j(not_equal, ¬_array_function); |
| 2385 | 2382 |
| 2386 // The target function is the Array constructor, | 2383 // The target function is the Array constructor, |
| 2387 // Create an AllocationSite if we don't already have it, store it in the slot. | 2384 // Create an AllocationSite if we don't already have it, store it in the cell |
| 2388 { | 2385 { |
| 2389 FrameScope scope(masm, StackFrame::INTERNAL); | 2386 FrameScope scope(masm, StackFrame::INTERNAL); |
| 2390 | 2387 |
| 2391 // Arguments register must be smi-tagged to call out. | 2388 // Arguments register must be smi-tagged to call out. |
| 2392 __ SmiTag(eax); | 2389 __ SmiTag(eax); |
| 2393 __ push(eax); | 2390 __ push(eax); |
| 2394 __ push(edi); | 2391 __ push(edi); |
| 2395 __ push(edx); | |
| 2396 __ push(ebx); | 2392 __ push(ebx); |
| 2397 | 2393 |
| 2398 CreateAllocationSiteStub create_stub; | 2394 CreateAllocationSiteStub create_stub; |
| 2399 __ CallStub(&create_stub); | 2395 __ CallStub(&create_stub); |
| 2400 | 2396 |
| 2401 __ pop(ebx); | 2397 __ pop(ebx); |
| 2402 __ pop(edx); | |
| 2403 __ pop(edi); | 2398 __ pop(edi); |
| 2404 __ pop(eax); | 2399 __ pop(eax); |
| 2405 __ SmiUntag(eax); | 2400 __ SmiUntag(eax); |
| 2406 } | 2401 } |
| 2407 __ jmp(&done); | 2402 __ jmp(&done); |
| 2408 | 2403 |
| 2409 __ bind(¬_array_function); | 2404 __ bind(¬_array_function); |
| 2410 __ mov(FieldOperand(ebx, edx, times_half_pointer_size, | 2405 __ mov(FieldOperand(ebx, Cell::kValueOffset), edi); |
| 2411 FixedArray::kHeaderSize), | 2406 // No need for a write barrier here - cells are rescanned. |
| 2412 edi); | |
| 2413 // We won't need edx or ebx anymore, just save edi | |
| 2414 __ push(edi); | |
| 2415 __ push(ebx); | |
| 2416 __ push(edx); | |
| 2417 __ RecordWriteArray(ebx, edi, edx, kDontSaveFPRegs, | |
| 2418 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | |
| 2419 __ pop(edx); | |
| 2420 __ pop(ebx); | |
| 2421 __ pop(edi); | |
| 2422 | 2407 |
| 2423 __ bind(&done); | 2408 __ bind(&done); |
| 2424 } | 2409 } |
| 2425 | 2410 |
| 2426 | 2411 |
| 2427 void CallFunctionStub::Generate(MacroAssembler* masm) { | 2412 void CallFunctionStub::Generate(MacroAssembler* masm) { |
| 2428 // ebx : feedback vector | 2413 // ebx : cache cell for call target |
| 2429 // edx : (only if ebx is not undefined) slot in feedback vector (Smi) | |
| 2430 // edi : the function to call | 2414 // edi : the function to call |
| 2431 Isolate* isolate = masm->isolate(); | 2415 Isolate* isolate = masm->isolate(); |
| 2432 Label slow, non_function, wrap, cont; | 2416 Label slow, non_function, wrap, cont; |
| 2433 | 2417 |
| 2434 if (NeedsChecks()) { | 2418 if (NeedsChecks()) { |
| 2435 // Check that the function really is a JavaScript function. | 2419 // Check that the function really is a JavaScript function. |
| 2436 __ JumpIfSmi(edi, &non_function); | 2420 __ JumpIfSmi(edi, &non_function); |
| 2437 | 2421 |
| 2438 // Goto slow case if we do not have a function. | 2422 // Goto slow case if we do not have a function. |
| 2439 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); | 2423 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2478 | 2462 |
| 2479 __ InvokeFunction(edi, actual, JUMP_FUNCTION, NullCallWrapper()); | 2463 __ InvokeFunction(edi, actual, JUMP_FUNCTION, NullCallWrapper()); |
| 2480 | 2464 |
| 2481 if (NeedsChecks()) { | 2465 if (NeedsChecks()) { |
| 2482 // Slow-case: Non-function called. | 2466 // Slow-case: Non-function called. |
| 2483 __ bind(&slow); | 2467 __ bind(&slow); |
| 2484 if (RecordCallTarget()) { | 2468 if (RecordCallTarget()) { |
| 2485 // If there is a call target cache, mark it megamorphic in the | 2469 // If there is a call target cache, mark it megamorphic in the |
| 2486 // non-function case. MegamorphicSentinel is an immortal immovable | 2470 // non-function case. MegamorphicSentinel is an immortal immovable |
| 2487 // object (undefined) so no write barrier is needed. | 2471 // object (undefined) so no write barrier is needed. |
| 2488 __ mov(FieldOperand(ebx, edx, times_half_pointer_size, | 2472 __ mov(FieldOperand(ebx, Cell::kValueOffset), |
| 2489 FixedArray::kHeaderSize), | 2473 Immediate(TypeFeedbackCells::MegamorphicSentinel(isolate))); |
| 2490 Immediate(TypeFeedbackInfo::MegamorphicSentinel(isolate))); | |
| 2491 } | 2474 } |
| 2492 // Check for function proxy. | 2475 // Check for function proxy. |
| 2493 __ CmpInstanceType(ecx, JS_FUNCTION_PROXY_TYPE); | 2476 __ CmpInstanceType(ecx, JS_FUNCTION_PROXY_TYPE); |
| 2494 __ j(not_equal, &non_function); | 2477 __ j(not_equal, &non_function); |
| 2495 __ pop(ecx); | 2478 __ pop(ecx); |
| 2496 __ push(edi); // put proxy as additional argument under return address | 2479 __ push(edi); // put proxy as additional argument under return address |
| 2497 __ push(ecx); | 2480 __ push(ecx); |
| 2498 __ Set(eax, Immediate(argc_ + 1)); | 2481 __ Set(eax, Immediate(argc_ + 1)); |
| 2499 __ Set(ebx, Immediate(0)); | 2482 __ Set(ebx, Immediate(0)); |
| 2500 __ GetBuiltinEntry(edx, Builtins::CALL_FUNCTION_PROXY); | 2483 __ GetBuiltinEntry(edx, Builtins::CALL_FUNCTION_PROXY); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2524 __ pop(edi); | 2507 __ pop(edi); |
| 2525 } | 2508 } |
| 2526 __ mov(Operand(esp, (argc_ + 1) * kPointerSize), eax); | 2509 __ mov(Operand(esp, (argc_ + 1) * kPointerSize), eax); |
| 2527 __ jmp(&cont); | 2510 __ jmp(&cont); |
| 2528 } | 2511 } |
| 2529 } | 2512 } |
| 2530 | 2513 |
| 2531 | 2514 |
| 2532 void CallConstructStub::Generate(MacroAssembler* masm) { | 2515 void CallConstructStub::Generate(MacroAssembler* masm) { |
| 2533 // eax : number of arguments | 2516 // eax : number of arguments |
| 2534 // ebx : feedback vector | 2517 // ebx : cache cell for call target |
| 2535 // edx : (only if ebx is not undefined) slot in feedback vector (Smi) | |
| 2536 // edi : constructor function | 2518 // edi : constructor function |
| 2537 Label slow, non_function_call; | 2519 Label slow, non_function_call; |
| 2538 | 2520 |
| 2539 // Check that function is not a smi. | 2521 // Check that function is not a smi. |
| 2540 __ JumpIfSmi(edi, &non_function_call); | 2522 __ JumpIfSmi(edi, &non_function_call); |
| 2541 // Check that function is a JSFunction. | 2523 // Check that function is a JSFunction. |
| 2542 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); | 2524 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); |
| 2543 __ j(not_equal, &slow); | 2525 __ j(not_equal, &slow); |
| 2544 | 2526 |
| 2545 if (RecordCallTarget()) { | 2527 if (RecordCallTarget()) { |
| (...skipping 2602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5148 CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode); | 5130 CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode); |
| 5149 } else { | 5131 } else { |
| 5150 UNREACHABLE(); | 5132 UNREACHABLE(); |
| 5151 } | 5133 } |
| 5152 } | 5134 } |
| 5153 | 5135 |
| 5154 | 5136 |
| 5155 void ArrayConstructorStub::Generate(MacroAssembler* masm) { | 5137 void ArrayConstructorStub::Generate(MacroAssembler* masm) { |
| 5156 // ----------- S t a t e ------------- | 5138 // ----------- S t a t e ------------- |
| 5157 // -- eax : argc (only if argument_count_ == ANY) | 5139 // -- eax : argc (only if argument_count_ == ANY) |
| 5158 // -- ebx : feedback vector (fixed array or undefined) | 5140 // -- ebx : type info cell |
| 5159 // -- edx : slot index (if ebx is fixed array) | |
| 5160 // -- edi : constructor | 5141 // -- edi : constructor |
| 5161 // -- esp[0] : return address | 5142 // -- esp[0] : return address |
| 5162 // -- esp[4] : last argument | 5143 // -- esp[4] : last argument |
| 5163 // ----------------------------------- | 5144 // ----------------------------------- |
| 5164 Handle<Object> undefined_sentinel( | 5145 Handle<Object> undefined_sentinel( |
| 5165 masm->isolate()->heap()->undefined_value(), | 5146 masm->isolate()->heap()->undefined_value(), |
| 5166 masm->isolate()); | 5147 masm->isolate()); |
| 5167 | 5148 |
| 5168 if (FLAG_debug_code) { | 5149 if (FLAG_debug_code) { |
| 5169 // The array construct code is only set for the global and natives | 5150 // The array construct code is only set for the global and natives |
| 5170 // builtin Array functions which always have maps. | 5151 // builtin Array functions which always have maps. |
| 5171 | 5152 |
| 5172 // Initial map for the builtin Array function should be a map. | 5153 // Initial map for the builtin Array function should be a map. |
| 5173 __ mov(ecx, FieldOperand(edi, JSFunction::kPrototypeOrInitialMapOffset)); | 5154 __ mov(ecx, FieldOperand(edi, JSFunction::kPrototypeOrInitialMapOffset)); |
| 5174 // Will both indicate a NULL and a Smi. | 5155 // Will both indicate a NULL and a Smi. |
| 5175 __ test(ecx, Immediate(kSmiTagMask)); | 5156 __ test(ecx, Immediate(kSmiTagMask)); |
| 5176 __ Assert(not_zero, kUnexpectedInitialMapForArrayFunction); | 5157 __ Assert(not_zero, kUnexpectedInitialMapForArrayFunction); |
| 5177 __ CmpObjectType(ecx, MAP_TYPE, ecx); | 5158 __ CmpObjectType(ecx, MAP_TYPE, ecx); |
| 5178 __ Assert(equal, kUnexpectedInitialMapForArrayFunction); | 5159 __ Assert(equal, kUnexpectedInitialMapForArrayFunction); |
| 5179 | 5160 |
| 5180 // We should either have undefined in ebx or a valid fixed array. | 5161 // We should either have undefined in ebx or a valid cell |
| 5181 Label okay_here; | 5162 Label okay_here; |
| 5182 Handle<Map> fixed_array_map = masm->isolate()->factory()->fixed_array_map(); | 5163 Handle<Map> cell_map = masm->isolate()->factory()->cell_map(); |
| 5183 __ cmp(ebx, Immediate(undefined_sentinel)); | 5164 __ cmp(ebx, Immediate(undefined_sentinel)); |
| 5184 __ j(equal, &okay_here); | 5165 __ j(equal, &okay_here); |
| 5185 __ cmp(FieldOperand(ebx, 0), Immediate(fixed_array_map)); | 5166 __ cmp(FieldOperand(ebx, 0), Immediate(cell_map)); |
| 5186 __ Assert(equal, kExpectedFixedArrayInRegisterEbx); | 5167 __ Assert(equal, kExpectedPropertyCellInRegisterEbx); |
| 5187 | |
| 5188 // edx should be a smi if we don't have undefined in ebx. | |
| 5189 __ AssertSmi(edx); | |
| 5190 | |
| 5191 __ bind(&okay_here); | 5168 __ bind(&okay_here); |
| 5192 } | 5169 } |
| 5193 | 5170 |
| 5194 Label no_info; | 5171 Label no_info; |
| 5195 // If the feedback vector is undefined, or contains anything other than an | 5172 // If the type cell is undefined, or contains anything other than an |
| 5196 // AllocationSite, call an array constructor that doesn't use AllocationSites. | 5173 // AllocationSite, call an array constructor that doesn't use AllocationSites. |
| 5197 __ cmp(ebx, Immediate(undefined_sentinel)); | 5174 __ cmp(ebx, Immediate(undefined_sentinel)); |
| 5198 __ j(equal, &no_info); | 5175 __ j(equal, &no_info); |
| 5199 __ mov(ebx, FieldOperand(ebx, edx, times_half_pointer_size, | 5176 __ mov(ebx, FieldOperand(ebx, Cell::kValueOffset)); |
| 5200 FixedArray::kHeaderSize)); | |
| 5201 __ cmp(FieldOperand(ebx, 0), Immediate( | 5177 __ cmp(FieldOperand(ebx, 0), Immediate( |
| 5202 masm->isolate()->factory()->allocation_site_map())); | 5178 masm->isolate()->factory()->allocation_site_map())); |
| 5203 __ j(not_equal, &no_info); | 5179 __ j(not_equal, &no_info); |
| 5204 | 5180 |
| 5205 // Only look at the lower 16 bits of the transition info. | 5181 // Only look at the lower 16 bits of the transition info. |
| 5206 __ mov(edx, FieldOperand(ebx, AllocationSite::kTransitionInfoOffset)); | 5182 __ mov(edx, FieldOperand(ebx, AllocationSite::kTransitionInfoOffset)); |
| 5207 __ SmiUntag(edx); | 5183 __ SmiUntag(edx); |
| 5208 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); | 5184 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); |
| 5209 __ and_(edx, Immediate(AllocationSite::ElementsKindBits::kMask)); | 5185 __ and_(edx, Immediate(AllocationSite::ElementsKindBits::kMask)); |
| 5210 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); | 5186 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5246 | 5222 |
| 5247 __ bind(¬_one_case); | 5223 __ bind(¬_one_case); |
| 5248 InternalArrayNArgumentsConstructorStub stubN(kind); | 5224 InternalArrayNArgumentsConstructorStub stubN(kind); |
| 5249 __ TailCallStub(&stubN); | 5225 __ TailCallStub(&stubN); |
| 5250 } | 5226 } |
| 5251 | 5227 |
| 5252 | 5228 |
| 5253 void InternalArrayConstructorStub::Generate(MacroAssembler* masm) { | 5229 void InternalArrayConstructorStub::Generate(MacroAssembler* masm) { |
| 5254 // ----------- S t a t e ------------- | 5230 // ----------- S t a t e ------------- |
| 5255 // -- eax : argc | 5231 // -- eax : argc |
| 5232 // -- ebx : type info cell |
| 5256 // -- edi : constructor | 5233 // -- edi : constructor |
| 5257 // -- esp[0] : return address | 5234 // -- esp[0] : return address |
| 5258 // -- esp[4] : last argument | 5235 // -- esp[4] : last argument |
| 5259 // ----------------------------------- | 5236 // ----------------------------------- |
| 5260 | 5237 |
| 5261 if (FLAG_debug_code) { | 5238 if (FLAG_debug_code) { |
| 5262 // The array construct code is only set for the global and natives | 5239 // The array construct code is only set for the global and natives |
| 5263 // builtin Array functions which always have maps. | 5240 // builtin Array functions which always have maps. |
| 5264 | 5241 |
| 5265 // Initial map for the builtin Array function should be a map. | 5242 // Initial map for the builtin Array function should be a map. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5317 // ----------------------------------- | 5294 // ----------------------------------- |
| 5318 | 5295 |
| 5319 Register callee = eax; | 5296 Register callee = eax; |
| 5320 Register call_data = ebx; | 5297 Register call_data = ebx; |
| 5321 Register holder = ecx; | 5298 Register holder = ecx; |
| 5322 Register api_function_address = edx; | 5299 Register api_function_address = edx; |
| 5323 Register return_address = edi; | 5300 Register return_address = edi; |
| 5324 Register context = esi; | 5301 Register context = esi; |
| 5325 | 5302 |
| 5326 int argc = ArgumentBits::decode(bit_field_); | 5303 int argc = ArgumentBits::decode(bit_field_); |
| 5327 bool is_store = IsStoreBits::decode(bit_field_); | 5304 bool restore_context = RestoreContextBits::decode(bit_field_); |
| 5328 bool call_data_undefined = CallDataUndefinedBits::decode(bit_field_); | 5305 bool call_data_undefined = CallDataUndefinedBits::decode(bit_field_); |
| 5329 | 5306 |
| 5330 typedef FunctionCallbackArguments FCA; | 5307 typedef FunctionCallbackArguments FCA; |
| 5331 | 5308 |
| 5332 STATIC_ASSERT(FCA::kContextSaveIndex == 6); | 5309 STATIC_ASSERT(FCA::kContextSaveIndex == 6); |
| 5333 STATIC_ASSERT(FCA::kCalleeIndex == 5); | 5310 STATIC_ASSERT(FCA::kCalleeIndex == 5); |
| 5334 STATIC_ASSERT(FCA::kDataIndex == 4); | 5311 STATIC_ASSERT(FCA::kDataIndex == 4); |
| 5335 STATIC_ASSERT(FCA::kReturnValueOffset == 3); | 5312 STATIC_ASSERT(FCA::kReturnValueOffset == 3); |
| 5336 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); | 5313 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); |
| 5337 STATIC_ASSERT(FCA::kIsolateIndex == 1); | 5314 STATIC_ASSERT(FCA::kIsolateIndex == 1); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5398 __ Set(ApiParameterOperand(5), Immediate(0)); | 5375 __ Set(ApiParameterOperand(5), Immediate(0)); |
| 5399 | 5376 |
| 5400 // v8::InvocationCallback's argument. | 5377 // v8::InvocationCallback's argument. |
| 5401 __ lea(scratch, ApiParameterOperand(2)); | 5378 __ lea(scratch, ApiParameterOperand(2)); |
| 5402 __ mov(ApiParameterOperand(0), scratch); | 5379 __ mov(ApiParameterOperand(0), scratch); |
| 5403 | 5380 |
| 5404 Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback); | 5381 Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback); |
| 5405 | 5382 |
| 5406 Operand context_restore_operand(ebp, | 5383 Operand context_restore_operand(ebp, |
| 5407 (2 + FCA::kContextSaveIndex) * kPointerSize); | 5384 (2 + FCA::kContextSaveIndex) * kPointerSize); |
| 5408 // Stores return the first js argument | 5385 Operand return_value_operand(ebp, |
| 5409 int return_value_offset = 0; | 5386 (2 + FCA::kReturnValueOffset) * kPointerSize); |
| 5410 if (is_store) { | |
| 5411 return_value_offset = 2 + FCA::kArgsLength; | |
| 5412 } else { | |
| 5413 return_value_offset = 2 + FCA::kReturnValueOffset; | |
| 5414 } | |
| 5415 Operand return_value_operand(ebp, return_value_offset * kPointerSize); | |
| 5416 __ CallApiFunctionAndReturn(api_function_address, | 5387 __ CallApiFunctionAndReturn(api_function_address, |
| 5417 thunk_address, | 5388 thunk_address, |
| 5418 ApiParameterOperand(1), | 5389 ApiParameterOperand(1), |
| 5419 argc + FCA::kArgsLength + 1, | 5390 argc + FCA::kArgsLength + 1, |
| 5420 return_value_operand, | 5391 return_value_operand, |
| 5421 &context_restore_operand); | 5392 restore_context ? |
| 5393 &context_restore_operand : NULL); |
| 5422 } | 5394 } |
| 5423 | 5395 |
| 5424 | 5396 |
| 5425 void CallApiGetterStub::Generate(MacroAssembler* masm) { | 5397 void CallApiGetterStub::Generate(MacroAssembler* masm) { |
| 5426 // ----------- S t a t e ------------- | 5398 // ----------- S t a t e ------------- |
| 5427 // -- esp[0] : return address | 5399 // -- esp[0] : return address |
| 5428 // -- esp[4] : name | 5400 // -- esp[4] : name |
| 5429 // -- esp[8 - kArgsLength*4] : PropertyCallbackArguments object | 5401 // -- esp[8 - kArgsLength*4] : PropertyCallbackArguments object |
| 5430 // -- ... | 5402 // -- ... |
| 5431 // -- edx : api_function_address | 5403 // -- edx : api_function_address |
| (...skipping 26 matching lines...) Expand all Loading... |
| 5458 Operand(ebp, 7 * kPointerSize), | 5430 Operand(ebp, 7 * kPointerSize), |
| 5459 NULL); | 5431 NULL); |
| 5460 } | 5432 } |
| 5461 | 5433 |
| 5462 | 5434 |
| 5463 #undef __ | 5435 #undef __ |
| 5464 | 5436 |
| 5465 } } // namespace v8::internal | 5437 } } // namespace v8::internal |
| 5466 | 5438 |
| 5467 #endif // V8_TARGET_ARCH_IA32 | 5439 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |