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 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1384 ? CALL_AS_FUNCTION | 1384 ? CALL_AS_FUNCTION |
1385 : CALL_AS_METHOD; | 1385 : CALL_AS_METHOD; |
1386 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION, | 1386 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION, |
1387 NullCallWrapper(), call_kind); | 1387 NullCallWrapper(), call_kind); |
1388 | 1388 |
1389 // Handle call cache miss. | 1389 // Handle call cache miss. |
1390 __ bind(&miss); | 1390 __ bind(&miss); |
1391 GenerateMissBranch(); | 1391 GenerateMissBranch(); |
1392 | 1392 |
1393 // Return the generated code. | 1393 // Return the generated code. |
1394 return GetCode(FIELD, name); | 1394 return GetCode(Code::FIELD, name); |
1395 } | 1395 } |
1396 | 1396 |
1397 | 1397 |
1398 Handle<Code> CallStubCompiler::CompileArrayPushCall( | 1398 Handle<Code> CallStubCompiler::CompileArrayPushCall( |
1399 Handle<Object> object, | 1399 Handle<Object> object, |
1400 Handle<JSObject> holder, | 1400 Handle<JSObject> holder, |
1401 Handle<JSGlobalPropertyCell> cell, | 1401 Handle<JSGlobalPropertyCell> cell, |
1402 Handle<JSFunction> function, | 1402 Handle<JSFunction> function, |
1403 Handle<String> name) { | 1403 Handle<String> name) { |
1404 // ----------- S t a t e ------------- | 1404 // ----------- S t a t e ------------- |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1908 ? CALL_AS_FUNCTION | 1908 ? CALL_AS_FUNCTION |
1909 : CALL_AS_METHOD; | 1909 : CALL_AS_METHOD; |
1910 __ InvokeFunction(function, arguments(), JUMP_FUNCTION, | 1910 __ InvokeFunction(function, arguments(), JUMP_FUNCTION, |
1911 NullCallWrapper(), call_kind); | 1911 NullCallWrapper(), call_kind); |
1912 | 1912 |
1913 __ bind(&miss); | 1913 __ bind(&miss); |
1914 // rcx: function name. | 1914 // rcx: function name. |
1915 GenerateMissBranch(); | 1915 GenerateMissBranch(); |
1916 | 1916 |
1917 // Return the generated code. | 1917 // Return the generated code. |
1918 return cell.is_null() ? GetCode(function) : GetCode(NORMAL, name); | 1918 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); |
1919 } | 1919 } |
1920 | 1920 |
1921 | 1921 |
1922 Handle<Code> CallStubCompiler::CompileMathFloorCall( | 1922 Handle<Code> CallStubCompiler::CompileMathFloorCall( |
1923 Handle<Object> object, | 1923 Handle<Object> object, |
1924 Handle<JSObject> holder, | 1924 Handle<JSObject> holder, |
1925 Handle<JSGlobalPropertyCell> cell, | 1925 Handle<JSGlobalPropertyCell> cell, |
1926 Handle<JSFunction> function, | 1926 Handle<JSFunction> function, |
1927 Handle<String> name) { | 1927 Handle<String> name) { |
1928 // TODO(872): implement this. | 1928 // TODO(872): implement this. |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2023 ? CALL_AS_FUNCTION | 2023 ? CALL_AS_FUNCTION |
2024 : CALL_AS_METHOD; | 2024 : CALL_AS_METHOD; |
2025 __ InvokeFunction(function, arguments(), JUMP_FUNCTION, | 2025 __ InvokeFunction(function, arguments(), JUMP_FUNCTION, |
2026 NullCallWrapper(), call_kind); | 2026 NullCallWrapper(), call_kind); |
2027 | 2027 |
2028 __ bind(&miss); | 2028 __ bind(&miss); |
2029 // rcx: function name. | 2029 // rcx: function name. |
2030 GenerateMissBranch(); | 2030 GenerateMissBranch(); |
2031 | 2031 |
2032 // Return the generated code. | 2032 // Return the generated code. |
2033 return cell.is_null() ? GetCode(function) : GetCode(NORMAL, name); | 2033 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); |
2034 } | 2034 } |
2035 | 2035 |
2036 | 2036 |
2037 Handle<Code> CallStubCompiler::CompileFastApiCall( | 2037 Handle<Code> CallStubCompiler::CompileFastApiCall( |
2038 const CallOptimization& optimization, | 2038 const CallOptimization& optimization, |
2039 Handle<Object> object, | 2039 Handle<Object> object, |
2040 Handle<JSObject> holder, | 2040 Handle<JSObject> holder, |
2041 Handle<JSGlobalPropertyCell> cell, | 2041 Handle<JSGlobalPropertyCell> cell, |
2042 Handle<JSFunction> function, | 2042 Handle<JSFunction> function, |
2043 Handle<String> name) { | 2043 Handle<String> name) { |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2272 ? CALL_AS_FUNCTION | 2272 ? CALL_AS_FUNCTION |
2273 : CALL_AS_METHOD; | 2273 : CALL_AS_METHOD; |
2274 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION, | 2274 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION, |
2275 NullCallWrapper(), call_kind); | 2275 NullCallWrapper(), call_kind); |
2276 | 2276 |
2277 // Handle load cache miss. | 2277 // Handle load cache miss. |
2278 __ bind(&miss); | 2278 __ bind(&miss); |
2279 GenerateMissBranch(); | 2279 GenerateMissBranch(); |
2280 | 2280 |
2281 // Return the generated code. | 2281 // Return the generated code. |
2282 return GetCode(INTERCEPTOR, name); | 2282 return GetCode(Code::INTERCEPTOR, name); |
2283 } | 2283 } |
2284 | 2284 |
2285 | 2285 |
2286 Handle<Code> CallStubCompiler::CompileCallGlobal( | 2286 Handle<Code> CallStubCompiler::CompileCallGlobal( |
2287 Handle<JSObject> object, | 2287 Handle<JSObject> object, |
2288 Handle<GlobalObject> holder, | 2288 Handle<GlobalObject> holder, |
2289 Handle<JSGlobalPropertyCell> cell, | 2289 Handle<JSGlobalPropertyCell> cell, |
2290 Handle<JSFunction> function, | 2290 Handle<JSFunction> function, |
2291 Handle<String> name) { | 2291 Handle<String> name) { |
2292 // ----------- S t a t e ------------- | 2292 // ----------- S t a t e ------------- |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2335 __ movq(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); | 2335 __ movq(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); |
2336 __ InvokeCode(rdx, expected, arguments(), JUMP_FUNCTION, | 2336 __ InvokeCode(rdx, expected, arguments(), JUMP_FUNCTION, |
2337 NullCallWrapper(), call_kind); | 2337 NullCallWrapper(), call_kind); |
2338 | 2338 |
2339 // Handle call cache miss. | 2339 // Handle call cache miss. |
2340 __ bind(&miss); | 2340 __ bind(&miss); |
2341 __ IncrementCounter(counters->call_global_inline_miss(), 1); | 2341 __ IncrementCounter(counters->call_global_inline_miss(), 1); |
2342 GenerateMissBranch(); | 2342 GenerateMissBranch(); |
2343 | 2343 |
2344 // Return the generated code. | 2344 // Return the generated code. |
2345 return GetCode(NORMAL, name); | 2345 return GetCode(Code::NORMAL, name); |
2346 } | 2346 } |
2347 | 2347 |
2348 | 2348 |
2349 Handle<Code> StoreStubCompiler::CompileStoreField(Handle<JSObject> object, | 2349 Handle<Code> StoreStubCompiler::CompileStoreField(Handle<JSObject> object, |
2350 int index, | 2350 int index, |
2351 Handle<Map> transition, | 2351 Handle<Map> transition, |
2352 Handle<String> name) { | 2352 Handle<String> name) { |
2353 // ----------- S t a t e ------------- | 2353 // ----------- S t a t e ------------- |
2354 // -- rax : value | 2354 // -- rax : value |
2355 // -- rcx : name | 2355 // -- rcx : name |
(...skipping 10 matching lines...) Expand all Loading... |
2366 name, | 2366 name, |
2367 rdx, rcx, rbx, rdi, | 2367 rdx, rcx, rbx, rdi, |
2368 &miss); | 2368 &miss); |
2369 | 2369 |
2370 // Handle store cache miss. | 2370 // Handle store cache miss. |
2371 __ bind(&miss); | 2371 __ bind(&miss); |
2372 Handle<Code> ic = isolate()->builtins()->StoreIC_Miss(); | 2372 Handle<Code> ic = isolate()->builtins()->StoreIC_Miss(); |
2373 __ Jump(ic, RelocInfo::CODE_TARGET); | 2373 __ Jump(ic, RelocInfo::CODE_TARGET); |
2374 | 2374 |
2375 // Return the generated code. | 2375 // Return the generated code. |
2376 return GetCode(transition.is_null() ? FIELD : MAP_TRANSITION, name); | 2376 return GetCode(transition.is_null() |
| 2377 ? Code::FIELD |
| 2378 : Code::MAP_TRANSITION, name); |
2377 } | 2379 } |
2378 | 2380 |
2379 | 2381 |
2380 Handle<Code> StoreStubCompiler::CompileStoreCallback( | 2382 Handle<Code> StoreStubCompiler::CompileStoreCallback( |
2381 Handle<JSObject> object, | 2383 Handle<JSObject> object, |
2382 Handle<AccessorInfo> callback, | 2384 Handle<AccessorInfo> callback, |
2383 Handle<String> name) { | 2385 Handle<String> name) { |
2384 // ----------- S t a t e ------------- | 2386 // ----------- S t a t e ------------- |
2385 // -- rax : value | 2387 // -- rax : value |
2386 // -- rcx : name | 2388 // -- rcx : name |
(...skipping 26 matching lines...) Expand all Loading... |
2413 ExternalReference store_callback_property = | 2415 ExternalReference store_callback_property = |
2414 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); | 2416 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); |
2415 __ TailCallExternalReference(store_callback_property, 4, 1); | 2417 __ TailCallExternalReference(store_callback_property, 4, 1); |
2416 | 2418 |
2417 // Handle store cache miss. | 2419 // Handle store cache miss. |
2418 __ bind(&miss); | 2420 __ bind(&miss); |
2419 Handle<Code> ic = isolate()->builtins()->StoreIC_Miss(); | 2421 Handle<Code> ic = isolate()->builtins()->StoreIC_Miss(); |
2420 __ Jump(ic, RelocInfo::CODE_TARGET); | 2422 __ Jump(ic, RelocInfo::CODE_TARGET); |
2421 | 2423 |
2422 // Return the generated code. | 2424 // Return the generated code. |
2423 return GetCode(CALLBACKS, name); | 2425 return GetCode(Code::CALLBACKS, name); |
2424 } | 2426 } |
2425 | 2427 |
2426 | 2428 |
2427 Handle<Code> StoreStubCompiler::CompileStoreViaSetter( | 2429 Handle<Code> StoreStubCompiler::CompileStoreViaSetter( |
2428 Handle<JSObject> receiver, | 2430 Handle<JSObject> receiver, |
2429 Handle<JSFunction> setter, | 2431 Handle<JSFunction> setter, |
2430 Handle<String> name) { | 2432 Handle<String> name) { |
2431 // ----------- S t a t e ------------- | 2433 // ----------- S t a t e ------------- |
2432 // -- rax : value | 2434 // -- rax : value |
2433 // -- rcx : name | 2435 // -- rcx : name |
(...skipping 25 matching lines...) Expand all Loading... |
2459 // Restore context register. | 2461 // Restore context register. |
2460 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 2462 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
2461 } | 2463 } |
2462 __ ret(0); | 2464 __ ret(0); |
2463 | 2465 |
2464 __ bind(&miss); | 2466 __ bind(&miss); |
2465 Handle<Code> ic = isolate()->builtins()->StoreIC_Miss(); | 2467 Handle<Code> ic = isolate()->builtins()->StoreIC_Miss(); |
2466 __ Jump(ic, RelocInfo::CODE_TARGET); | 2468 __ Jump(ic, RelocInfo::CODE_TARGET); |
2467 | 2469 |
2468 // Return the generated code. | 2470 // Return the generated code. |
2469 return GetCode(CALLBACKS, name); | 2471 return GetCode(Code::CALLBACKS, name); |
2470 } | 2472 } |
2471 | 2473 |
2472 | 2474 |
2473 Handle<Code> StoreStubCompiler::CompileStoreInterceptor( | 2475 Handle<Code> StoreStubCompiler::CompileStoreInterceptor( |
2474 Handle<JSObject> receiver, | 2476 Handle<JSObject> receiver, |
2475 Handle<String> name) { | 2477 Handle<String> name) { |
2476 // ----------- S t a t e ------------- | 2478 // ----------- S t a t e ------------- |
2477 // -- rax : value | 2479 // -- rax : value |
2478 // -- rcx : name | 2480 // -- rcx : name |
2479 // -- rdx : receiver | 2481 // -- rdx : receiver |
(...skipping 25 matching lines...) Expand all Loading... |
2505 ExternalReference store_ic_property = | 2507 ExternalReference store_ic_property = |
2506 ExternalReference(IC_Utility(IC::kStoreInterceptorProperty), isolate()); | 2508 ExternalReference(IC_Utility(IC::kStoreInterceptorProperty), isolate()); |
2507 __ TailCallExternalReference(store_ic_property, 4, 1); | 2509 __ TailCallExternalReference(store_ic_property, 4, 1); |
2508 | 2510 |
2509 // Handle store cache miss. | 2511 // Handle store cache miss. |
2510 __ bind(&miss); | 2512 __ bind(&miss); |
2511 Handle<Code> ic = isolate()->builtins()->StoreIC_Miss(); | 2513 Handle<Code> ic = isolate()->builtins()->StoreIC_Miss(); |
2512 __ Jump(ic, RelocInfo::CODE_TARGET); | 2514 __ Jump(ic, RelocInfo::CODE_TARGET); |
2513 | 2515 |
2514 // Return the generated code. | 2516 // Return the generated code. |
2515 return GetCode(INTERCEPTOR, name); | 2517 return GetCode(Code::INTERCEPTOR, name); |
2516 } | 2518 } |
2517 | 2519 |
2518 | 2520 |
2519 Handle<Code> StoreStubCompiler::CompileStoreGlobal( | 2521 Handle<Code> StoreStubCompiler::CompileStoreGlobal( |
2520 Handle<GlobalObject> object, | 2522 Handle<GlobalObject> object, |
2521 Handle<JSGlobalPropertyCell> cell, | 2523 Handle<JSGlobalPropertyCell> cell, |
2522 Handle<String> name) { | 2524 Handle<String> name) { |
2523 // ----------- S t a t e ------------- | 2525 // ----------- S t a t e ------------- |
2524 // -- rax : value | 2526 // -- rax : value |
2525 // -- rcx : name | 2527 // -- rcx : name |
(...skipping 27 matching lines...) Expand all Loading... |
2553 __ IncrementCounter(counters->named_store_global_inline(), 1); | 2555 __ IncrementCounter(counters->named_store_global_inline(), 1); |
2554 __ ret(0); | 2556 __ ret(0); |
2555 | 2557 |
2556 // Handle store cache miss. | 2558 // Handle store cache miss. |
2557 __ bind(&miss); | 2559 __ bind(&miss); |
2558 __ IncrementCounter(counters->named_store_global_inline_miss(), 1); | 2560 __ IncrementCounter(counters->named_store_global_inline_miss(), 1); |
2559 Handle<Code> ic = isolate()->builtins()->StoreIC_Miss(); | 2561 Handle<Code> ic = isolate()->builtins()->StoreIC_Miss(); |
2560 __ Jump(ic, RelocInfo::CODE_TARGET); | 2562 __ Jump(ic, RelocInfo::CODE_TARGET); |
2561 | 2563 |
2562 // Return the generated code. | 2564 // Return the generated code. |
2563 return GetCode(NORMAL, name); | 2565 return GetCode(Code::NORMAL, name); |
2564 } | 2566 } |
2565 | 2567 |
2566 | 2568 |
2567 Handle<Code> KeyedStoreStubCompiler::CompileStoreField(Handle<JSObject> object, | 2569 Handle<Code> KeyedStoreStubCompiler::CompileStoreField(Handle<JSObject> object, |
2568 int index, | 2570 int index, |
2569 Handle<Map> transition, | 2571 Handle<Map> transition, |
2570 Handle<String> name) { | 2572 Handle<String> name) { |
2571 // ----------- S t a t e ------------- | 2573 // ----------- S t a t e ------------- |
2572 // -- rax : value | 2574 // -- rax : value |
2573 // -- rcx : key | 2575 // -- rcx : key |
(...skipping 18 matching lines...) Expand all Loading... |
2592 rdx, rcx, rbx, rdi, | 2594 rdx, rcx, rbx, rdi, |
2593 &miss); | 2595 &miss); |
2594 | 2596 |
2595 // Handle store cache miss. | 2597 // Handle store cache miss. |
2596 __ bind(&miss); | 2598 __ bind(&miss); |
2597 __ DecrementCounter(counters->keyed_store_field(), 1); | 2599 __ DecrementCounter(counters->keyed_store_field(), 1); |
2598 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss(); | 2600 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss(); |
2599 __ Jump(ic, RelocInfo::CODE_TARGET); | 2601 __ Jump(ic, RelocInfo::CODE_TARGET); |
2600 | 2602 |
2601 // Return the generated code. | 2603 // Return the generated code. |
2602 return GetCode(transition.is_null() ? FIELD : MAP_TRANSITION, name); | 2604 return GetCode(transition.is_null() |
| 2605 ? Code::FIELD |
| 2606 : Code::MAP_TRANSITION, name); |
2603 } | 2607 } |
2604 | 2608 |
2605 | 2609 |
2606 Handle<Code> KeyedStoreStubCompiler::CompileStoreElement( | 2610 Handle<Code> KeyedStoreStubCompiler::CompileStoreElement( |
2607 Handle<Map> receiver_map) { | 2611 Handle<Map> receiver_map) { |
2608 // ----------- S t a t e ------------- | 2612 // ----------- S t a t e ------------- |
2609 // -- rax : value | 2613 // -- rax : value |
2610 // -- rcx : key | 2614 // -- rcx : key |
2611 // -- rdx : receiver | 2615 // -- rdx : receiver |
2612 // -- rsp[0] : return address | 2616 // -- rsp[0] : return address |
2613 // ----------------------------------- | 2617 // ----------------------------------- |
2614 | 2618 |
2615 ElementsKind elements_kind = receiver_map->elements_kind(); | 2619 ElementsKind elements_kind = receiver_map->elements_kind(); |
2616 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; | 2620 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; |
2617 Handle<Code> stub = | 2621 Handle<Code> stub = |
2618 KeyedStoreElementStub(is_js_array, elements_kind, grow_mode_).GetCode(); | 2622 KeyedStoreElementStub(is_js_array, elements_kind, grow_mode_).GetCode(); |
2619 | 2623 |
2620 __ DispatchMap(rdx, receiver_map, stub, DO_SMI_CHECK); | 2624 __ DispatchMap(rdx, receiver_map, stub, DO_SMI_CHECK); |
2621 | 2625 |
2622 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss(); | 2626 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss(); |
2623 __ jmp(ic, RelocInfo::CODE_TARGET); | 2627 __ jmp(ic, RelocInfo::CODE_TARGET); |
2624 | 2628 |
2625 // Return the generated code. | 2629 // Return the generated code. |
2626 return GetCode(NORMAL, factory()->empty_string()); | 2630 return GetCode(Code::NORMAL, factory()->empty_string()); |
2627 } | 2631 } |
2628 | 2632 |
2629 | 2633 |
2630 Handle<Code> KeyedStoreStubCompiler::CompileStorePolymorphic( | 2634 Handle<Code> KeyedStoreStubCompiler::CompileStorePolymorphic( |
2631 MapHandleList* receiver_maps, | 2635 MapHandleList* receiver_maps, |
2632 CodeHandleList* handler_stubs, | 2636 CodeHandleList* handler_stubs, |
2633 MapHandleList* transitioned_maps) { | 2637 MapHandleList* transitioned_maps) { |
2634 // ----------- S t a t e ------------- | 2638 // ----------- S t a t e ------------- |
2635 // -- rax : value | 2639 // -- rax : value |
2636 // -- rcx : key | 2640 // -- rcx : key |
(...skipping 17 matching lines...) Expand all Loading... |
2654 __ jmp(handler_stubs->at(i), RelocInfo::CODE_TARGET); | 2658 __ jmp(handler_stubs->at(i), RelocInfo::CODE_TARGET); |
2655 __ bind(&next_map); | 2659 __ bind(&next_map); |
2656 } | 2660 } |
2657 } | 2661 } |
2658 | 2662 |
2659 __ bind(&miss); | 2663 __ bind(&miss); |
2660 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss(); | 2664 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss(); |
2661 __ jmp(ic, RelocInfo::CODE_TARGET); | 2665 __ jmp(ic, RelocInfo::CODE_TARGET); |
2662 | 2666 |
2663 // Return the generated code. | 2667 // Return the generated code. |
2664 return GetCode(NORMAL, factory()->empty_string(), MEGAMORPHIC); | 2668 return GetCode(Code::NORMAL, factory()->empty_string(), MEGAMORPHIC); |
2665 } | 2669 } |
2666 | 2670 |
2667 | 2671 |
2668 Handle<Code> LoadStubCompiler::CompileLoadNonexistent(Handle<String> name, | 2672 Handle<Code> LoadStubCompiler::CompileLoadNonexistent(Handle<String> name, |
2669 Handle<JSObject> object, | 2673 Handle<JSObject> object, |
2670 Handle<JSObject> last) { | 2674 Handle<JSObject> last) { |
2671 // ----------- S t a t e ------------- | 2675 // ----------- S t a t e ------------- |
2672 // -- rax : receiver | 2676 // -- rax : receiver |
2673 // -- rcx : name | 2677 // -- rcx : name |
2674 // -- rsp[0] : return address | 2678 // -- rsp[0] : return address |
(...skipping 17 matching lines...) Expand all Loading... |
2692 | 2696 |
2693 // Return undefined if maps of the full prototype chain are still the | 2697 // Return undefined if maps of the full prototype chain are still the |
2694 // same and no global property with this name contains a value. | 2698 // same and no global property with this name contains a value. |
2695 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); | 2699 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); |
2696 __ ret(0); | 2700 __ ret(0); |
2697 | 2701 |
2698 __ bind(&miss); | 2702 __ bind(&miss); |
2699 GenerateLoadMiss(masm(), Code::LOAD_IC); | 2703 GenerateLoadMiss(masm(), Code::LOAD_IC); |
2700 | 2704 |
2701 // Return the generated code. | 2705 // Return the generated code. |
2702 return GetCode(NONEXISTENT, factory()->empty_string()); | 2706 return GetCode(Code::NONEXISTENT, factory()->empty_string()); |
2703 } | 2707 } |
2704 | 2708 |
2705 | 2709 |
2706 Handle<Code> LoadStubCompiler::CompileLoadField(Handle<JSObject> object, | 2710 Handle<Code> LoadStubCompiler::CompileLoadField(Handle<JSObject> object, |
2707 Handle<JSObject> holder, | 2711 Handle<JSObject> holder, |
2708 int index, | 2712 int index, |
2709 Handle<String> name) { | 2713 Handle<String> name) { |
2710 // ----------- S t a t e ------------- | 2714 // ----------- S t a t e ------------- |
2711 // -- rax : receiver | 2715 // -- rax : receiver |
2712 // -- rcx : name | 2716 // -- rcx : name |
2713 // -- rsp[0] : return address | 2717 // -- rsp[0] : return address |
2714 // ----------------------------------- | 2718 // ----------------------------------- |
2715 Label miss; | 2719 Label miss; |
2716 | 2720 |
2717 GenerateLoadField(object, holder, rax, rbx, rdx, rdi, index, name, &miss); | 2721 GenerateLoadField(object, holder, rax, rbx, rdx, rdi, index, name, &miss); |
2718 __ bind(&miss); | 2722 __ bind(&miss); |
2719 GenerateLoadMiss(masm(), Code::LOAD_IC); | 2723 GenerateLoadMiss(masm(), Code::LOAD_IC); |
2720 | 2724 |
2721 // Return the generated code. | 2725 // Return the generated code. |
2722 return GetCode(FIELD, name); | 2726 return GetCode(Code::FIELD, name); |
2723 } | 2727 } |
2724 | 2728 |
2725 | 2729 |
2726 Handle<Code> LoadStubCompiler::CompileLoadCallback( | 2730 Handle<Code> LoadStubCompiler::CompileLoadCallback( |
2727 Handle<String> name, | 2731 Handle<String> name, |
2728 Handle<JSObject> object, | 2732 Handle<JSObject> object, |
2729 Handle<JSObject> holder, | 2733 Handle<JSObject> holder, |
2730 Handle<AccessorInfo> callback) { | 2734 Handle<AccessorInfo> callback) { |
2731 // ----------- S t a t e ------------- | 2735 // ----------- S t a t e ------------- |
2732 // -- rax : receiver | 2736 // -- rax : receiver |
2733 // -- rcx : name | 2737 // -- rcx : name |
2734 // -- rsp[0] : return address | 2738 // -- rsp[0] : return address |
2735 // ----------------------------------- | 2739 // ----------------------------------- |
2736 Label miss; | 2740 Label miss; |
2737 GenerateLoadCallback(object, holder, rax, rcx, rdx, rbx, rdi, callback, | 2741 GenerateLoadCallback(object, holder, rax, rcx, rdx, rbx, rdi, callback, |
2738 name, &miss); | 2742 name, &miss); |
2739 __ bind(&miss); | 2743 __ bind(&miss); |
2740 GenerateLoadMiss(masm(), Code::LOAD_IC); | 2744 GenerateLoadMiss(masm(), Code::LOAD_IC); |
2741 | 2745 |
2742 // Return the generated code. | 2746 // Return the generated code. |
2743 return GetCode(CALLBACKS, name); | 2747 return GetCode(Code::CALLBACKS, name); |
2744 } | 2748 } |
2745 | 2749 |
2746 | 2750 |
2747 Handle<Code> LoadStubCompiler::CompileLoadViaGetter( | 2751 Handle<Code> LoadStubCompiler::CompileLoadViaGetter( |
2748 Handle<String> name, | 2752 Handle<String> name, |
2749 Handle<JSObject> receiver, | 2753 Handle<JSObject> receiver, |
2750 Handle<JSObject> holder, | 2754 Handle<JSObject> holder, |
2751 Handle<JSFunction> getter) { | 2755 Handle<JSFunction> getter) { |
2752 // ----------- S t a t e ------------- | 2756 // ----------- S t a t e ------------- |
2753 // -- rax : receiver | 2757 // -- rax : receiver |
(...skipping 17 matching lines...) Expand all Loading... |
2771 | 2775 |
2772 // Restore context register. | 2776 // Restore context register. |
2773 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 2777 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
2774 } | 2778 } |
2775 __ ret(0); | 2779 __ ret(0); |
2776 | 2780 |
2777 __ bind(&miss); | 2781 __ bind(&miss); |
2778 GenerateLoadMiss(masm(), Code::LOAD_IC); | 2782 GenerateLoadMiss(masm(), Code::LOAD_IC); |
2779 | 2783 |
2780 // Return the generated code. | 2784 // Return the generated code. |
2781 return GetCode(CALLBACKS, name); | 2785 return GetCode(Code::CALLBACKS, name); |
2782 } | 2786 } |
2783 | 2787 |
2784 | 2788 |
2785 Handle<Code> LoadStubCompiler::CompileLoadConstant(Handle<JSObject> object, | 2789 Handle<Code> LoadStubCompiler::CompileLoadConstant(Handle<JSObject> object, |
2786 Handle<JSObject> holder, | 2790 Handle<JSObject> holder, |
2787 Handle<JSFunction> value, | 2791 Handle<JSFunction> value, |
2788 Handle<String> name) { | 2792 Handle<String> name) { |
2789 // ----------- S t a t e ------------- | 2793 // ----------- S t a t e ------------- |
2790 // -- rax : receiver | 2794 // -- rax : receiver |
2791 // -- rcx : name | 2795 // -- rcx : name |
2792 // -- rsp[0] : return address | 2796 // -- rsp[0] : return address |
2793 // ----------------------------------- | 2797 // ----------------------------------- |
2794 Label miss; | 2798 Label miss; |
2795 | 2799 |
2796 GenerateLoadConstant(object, holder, rax, rbx, rdx, rdi, value, name, &miss); | 2800 GenerateLoadConstant(object, holder, rax, rbx, rdx, rdi, value, name, &miss); |
2797 __ bind(&miss); | 2801 __ bind(&miss); |
2798 GenerateLoadMiss(masm(), Code::LOAD_IC); | 2802 GenerateLoadMiss(masm(), Code::LOAD_IC); |
2799 | 2803 |
2800 // Return the generated code. | 2804 // Return the generated code. |
2801 return GetCode(CONSTANT_FUNCTION, name); | 2805 return GetCode(Code::CONSTANT_FUNCTION, name); |
2802 } | 2806 } |
2803 | 2807 |
2804 | 2808 |
2805 Handle<Code> LoadStubCompiler::CompileLoadInterceptor(Handle<JSObject> receiver, | 2809 Handle<Code> LoadStubCompiler::CompileLoadInterceptor(Handle<JSObject> receiver, |
2806 Handle<JSObject> holder, | 2810 Handle<JSObject> holder, |
2807 Handle<String> name) { | 2811 Handle<String> name) { |
2808 // ----------- S t a t e ------------- | 2812 // ----------- S t a t e ------------- |
2809 // -- rax : receiver | 2813 // -- rax : receiver |
2810 // -- rcx : name | 2814 // -- rcx : name |
2811 // -- rsp[0] : return address | 2815 // -- rsp[0] : return address |
2812 // ----------------------------------- | 2816 // ----------------------------------- |
2813 Label miss; | 2817 Label miss; |
2814 LookupResult lookup(isolate()); | 2818 LookupResult lookup(isolate()); |
2815 LookupPostInterceptor(holder, name, &lookup); | 2819 LookupPostInterceptor(holder, name, &lookup); |
2816 | 2820 |
2817 // TODO(368): Compile in the whole chain: all the interceptors in | 2821 // TODO(368): Compile in the whole chain: all the interceptors in |
2818 // prototypes and ultimate answer. | 2822 // prototypes and ultimate answer. |
2819 GenerateLoadInterceptor(receiver, holder, &lookup, rax, rcx, rdx, rbx, rdi, | 2823 GenerateLoadInterceptor(receiver, holder, &lookup, rax, rcx, rdx, rbx, rdi, |
2820 name, &miss); | 2824 name, &miss); |
2821 __ bind(&miss); | 2825 __ bind(&miss); |
2822 GenerateLoadMiss(masm(), Code::LOAD_IC); | 2826 GenerateLoadMiss(masm(), Code::LOAD_IC); |
2823 | 2827 |
2824 // Return the generated code. | 2828 // Return the generated code. |
2825 return GetCode(INTERCEPTOR, name); | 2829 return GetCode(Code::INTERCEPTOR, name); |
2826 } | 2830 } |
2827 | 2831 |
2828 | 2832 |
2829 Handle<Code> LoadStubCompiler::CompileLoadGlobal( | 2833 Handle<Code> LoadStubCompiler::CompileLoadGlobal( |
2830 Handle<JSObject> object, | 2834 Handle<JSObject> object, |
2831 Handle<GlobalObject> holder, | 2835 Handle<GlobalObject> holder, |
2832 Handle<JSGlobalPropertyCell> cell, | 2836 Handle<JSGlobalPropertyCell> cell, |
2833 Handle<String> name, | 2837 Handle<String> name, |
2834 bool is_dont_delete) { | 2838 bool is_dont_delete) { |
2835 // ----------- S t a t e ------------- | 2839 // ----------- S t a t e ------------- |
(...skipping 23 matching lines...) Expand all Loading... |
2859 Counters* counters = isolate()->counters(); | 2863 Counters* counters = isolate()->counters(); |
2860 __ IncrementCounter(counters->named_load_global_stub(), 1); | 2864 __ IncrementCounter(counters->named_load_global_stub(), 1); |
2861 __ movq(rax, rbx); | 2865 __ movq(rax, rbx); |
2862 __ ret(0); | 2866 __ ret(0); |
2863 | 2867 |
2864 __ bind(&miss); | 2868 __ bind(&miss); |
2865 __ IncrementCounter(counters->named_load_global_stub_miss(), 1); | 2869 __ IncrementCounter(counters->named_load_global_stub_miss(), 1); |
2866 GenerateLoadMiss(masm(), Code::LOAD_IC); | 2870 GenerateLoadMiss(masm(), Code::LOAD_IC); |
2867 | 2871 |
2868 // Return the generated code. | 2872 // Return the generated code. |
2869 return GetCode(NORMAL, name); | 2873 return GetCode(Code::NORMAL, name); |
2870 } | 2874 } |
2871 | 2875 |
2872 | 2876 |
2873 Handle<Code> KeyedLoadStubCompiler::CompileLoadField(Handle<String> name, | 2877 Handle<Code> KeyedLoadStubCompiler::CompileLoadField(Handle<String> name, |
2874 Handle<JSObject> receiver, | 2878 Handle<JSObject> receiver, |
2875 Handle<JSObject> holder, | 2879 Handle<JSObject> holder, |
2876 int index) { | 2880 int index) { |
2877 // ----------- S t a t e ------------- | 2881 // ----------- S t a t e ------------- |
2878 // -- rax : key | 2882 // -- rax : key |
2879 // -- rdx : receiver | 2883 // -- rdx : receiver |
2880 // -- rsp[0] : return address | 2884 // -- rsp[0] : return address |
2881 // ----------------------------------- | 2885 // ----------------------------------- |
2882 Label miss; | 2886 Label miss; |
2883 | 2887 |
2884 Counters* counters = isolate()->counters(); | 2888 Counters* counters = isolate()->counters(); |
2885 __ IncrementCounter(counters->keyed_load_field(), 1); | 2889 __ IncrementCounter(counters->keyed_load_field(), 1); |
2886 | 2890 |
2887 // Check that the name has not changed. | 2891 // Check that the name has not changed. |
2888 __ Cmp(rax, name); | 2892 __ Cmp(rax, name); |
2889 __ j(not_equal, &miss); | 2893 __ j(not_equal, &miss); |
2890 | 2894 |
2891 GenerateLoadField(receiver, holder, rdx, rbx, rcx, rdi, index, name, &miss); | 2895 GenerateLoadField(receiver, holder, rdx, rbx, rcx, rdi, index, name, &miss); |
2892 | 2896 |
2893 __ bind(&miss); | 2897 __ bind(&miss); |
2894 __ DecrementCounter(counters->keyed_load_field(), 1); | 2898 __ DecrementCounter(counters->keyed_load_field(), 1); |
2895 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 2899 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
2896 | 2900 |
2897 // Return the generated code. | 2901 // Return the generated code. |
2898 return GetCode(FIELD, name); | 2902 return GetCode(Code::FIELD, name); |
2899 } | 2903 } |
2900 | 2904 |
2901 | 2905 |
2902 Handle<Code> KeyedLoadStubCompiler::CompileLoadCallback( | 2906 Handle<Code> KeyedLoadStubCompiler::CompileLoadCallback( |
2903 Handle<String> name, | 2907 Handle<String> name, |
2904 Handle<JSObject> receiver, | 2908 Handle<JSObject> receiver, |
2905 Handle<JSObject> holder, | 2909 Handle<JSObject> holder, |
2906 Handle<AccessorInfo> callback) { | 2910 Handle<AccessorInfo> callback) { |
2907 // ----------- S t a t e ------------- | 2911 // ----------- S t a t e ------------- |
2908 // -- rax : key | 2912 // -- rax : key |
2909 // -- rdx : receiver | 2913 // -- rdx : receiver |
2910 // -- rsp[0] : return address | 2914 // -- rsp[0] : return address |
2911 // ----------------------------------- | 2915 // ----------------------------------- |
2912 Label miss; | 2916 Label miss; |
2913 Counters* counters = isolate()->counters(); | 2917 Counters* counters = isolate()->counters(); |
2914 __ IncrementCounter(counters->keyed_load_callback(), 1); | 2918 __ IncrementCounter(counters->keyed_load_callback(), 1); |
2915 | 2919 |
2916 // Check that the name has not changed. | 2920 // Check that the name has not changed. |
2917 __ Cmp(rax, name); | 2921 __ Cmp(rax, name); |
2918 __ j(not_equal, &miss); | 2922 __ j(not_equal, &miss); |
2919 | 2923 |
2920 GenerateLoadCallback(receiver, holder, rdx, rax, rbx, rcx, rdi, callback, | 2924 GenerateLoadCallback(receiver, holder, rdx, rax, rbx, rcx, rdi, callback, |
2921 name, &miss); | 2925 name, &miss); |
2922 __ bind(&miss); | 2926 __ bind(&miss); |
2923 __ DecrementCounter(counters->keyed_load_callback(), 1); | 2927 __ DecrementCounter(counters->keyed_load_callback(), 1); |
2924 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 2928 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
2925 | 2929 |
2926 // Return the generated code. | 2930 // Return the generated code. |
2927 return GetCode(CALLBACKS, name); | 2931 return GetCode(Code::CALLBACKS, name); |
2928 } | 2932 } |
2929 | 2933 |
2930 | 2934 |
2931 Handle<Code> KeyedLoadStubCompiler::CompileLoadConstant( | 2935 Handle<Code> KeyedLoadStubCompiler::CompileLoadConstant( |
2932 Handle<String> name, | 2936 Handle<String> name, |
2933 Handle<JSObject> receiver, | 2937 Handle<JSObject> receiver, |
2934 Handle<JSObject> holder, | 2938 Handle<JSObject> holder, |
2935 Handle<JSFunction> value) { | 2939 Handle<JSFunction> value) { |
2936 // ----------- S t a t e ------------- | 2940 // ----------- S t a t e ------------- |
2937 // -- rax : key | 2941 // -- rax : key |
2938 // -- rdx : receiver | 2942 // -- rdx : receiver |
2939 // -- rsp[0] : return address | 2943 // -- rsp[0] : return address |
2940 // ----------------------------------- | 2944 // ----------------------------------- |
2941 Label miss; | 2945 Label miss; |
2942 | 2946 |
2943 Counters* counters = isolate()->counters(); | 2947 Counters* counters = isolate()->counters(); |
2944 __ IncrementCounter(counters->keyed_load_constant_function(), 1); | 2948 __ IncrementCounter(counters->keyed_load_constant_function(), 1); |
2945 | 2949 |
2946 // Check that the name has not changed. | 2950 // Check that the name has not changed. |
2947 __ Cmp(rax, name); | 2951 __ Cmp(rax, name); |
2948 __ j(not_equal, &miss); | 2952 __ j(not_equal, &miss); |
2949 | 2953 |
2950 GenerateLoadConstant(receiver, holder, rdx, rbx, rcx, rdi, | 2954 GenerateLoadConstant(receiver, holder, rdx, rbx, rcx, rdi, |
2951 value, name, &miss); | 2955 value, name, &miss); |
2952 __ bind(&miss); | 2956 __ bind(&miss); |
2953 __ DecrementCounter(counters->keyed_load_constant_function(), 1); | 2957 __ DecrementCounter(counters->keyed_load_constant_function(), 1); |
2954 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 2958 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
2955 | 2959 |
2956 // Return the generated code. | 2960 // Return the generated code. |
2957 return GetCode(CONSTANT_FUNCTION, name); | 2961 return GetCode(Code::CONSTANT_FUNCTION, name); |
2958 } | 2962 } |
2959 | 2963 |
2960 | 2964 |
2961 Handle<Code> KeyedLoadStubCompiler::CompileLoadInterceptor( | 2965 Handle<Code> KeyedLoadStubCompiler::CompileLoadInterceptor( |
2962 Handle<JSObject> receiver, | 2966 Handle<JSObject> receiver, |
2963 Handle<JSObject> holder, | 2967 Handle<JSObject> holder, |
2964 Handle<String> name) { | 2968 Handle<String> name) { |
2965 // ----------- S t a t e ------------- | 2969 // ----------- S t a t e ------------- |
2966 // -- rax : key | 2970 // -- rax : key |
2967 // -- rdx : receiver | 2971 // -- rdx : receiver |
2968 // -- rsp[0] : return address | 2972 // -- rsp[0] : return address |
2969 // ----------------------------------- | 2973 // ----------------------------------- |
2970 Label miss; | 2974 Label miss; |
2971 Counters* counters = isolate()->counters(); | 2975 Counters* counters = isolate()->counters(); |
2972 __ IncrementCounter(counters->keyed_load_interceptor(), 1); | 2976 __ IncrementCounter(counters->keyed_load_interceptor(), 1); |
2973 | 2977 |
2974 // Check that the name has not changed. | 2978 // Check that the name has not changed. |
2975 __ Cmp(rax, name); | 2979 __ Cmp(rax, name); |
2976 __ j(not_equal, &miss); | 2980 __ j(not_equal, &miss); |
2977 | 2981 |
2978 LookupResult lookup(isolate()); | 2982 LookupResult lookup(isolate()); |
2979 LookupPostInterceptor(holder, name, &lookup); | 2983 LookupPostInterceptor(holder, name, &lookup); |
2980 GenerateLoadInterceptor(receiver, holder, &lookup, rdx, rax, rcx, rbx, rdi, | 2984 GenerateLoadInterceptor(receiver, holder, &lookup, rdx, rax, rcx, rbx, rdi, |
2981 name, &miss); | 2985 name, &miss); |
2982 __ bind(&miss); | 2986 __ bind(&miss); |
2983 __ DecrementCounter(counters->keyed_load_interceptor(), 1); | 2987 __ DecrementCounter(counters->keyed_load_interceptor(), 1); |
2984 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 2988 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
2985 | 2989 |
2986 // Return the generated code. | 2990 // Return the generated code. |
2987 return GetCode(INTERCEPTOR, name); | 2991 return GetCode(Code::INTERCEPTOR, name); |
2988 } | 2992 } |
2989 | 2993 |
2990 | 2994 |
2991 Handle<Code> KeyedLoadStubCompiler::CompileLoadArrayLength( | 2995 Handle<Code> KeyedLoadStubCompiler::CompileLoadArrayLength( |
2992 Handle<String> name) { | 2996 Handle<String> name) { |
2993 // ----------- S t a t e ------------- | 2997 // ----------- S t a t e ------------- |
2994 // -- rax : key | 2998 // -- rax : key |
2995 // -- rdx : receiver | 2999 // -- rdx : receiver |
2996 // -- rsp[0] : return address | 3000 // -- rsp[0] : return address |
2997 // ----------------------------------- | 3001 // ----------------------------------- |
2998 Label miss; | 3002 Label miss; |
2999 | 3003 |
3000 Counters* counters = isolate()->counters(); | 3004 Counters* counters = isolate()->counters(); |
3001 __ IncrementCounter(counters->keyed_load_array_length(), 1); | 3005 __ IncrementCounter(counters->keyed_load_array_length(), 1); |
3002 | 3006 |
3003 // Check that the name has not changed. | 3007 // Check that the name has not changed. |
3004 __ Cmp(rax, name); | 3008 __ Cmp(rax, name); |
3005 __ j(not_equal, &miss); | 3009 __ j(not_equal, &miss); |
3006 | 3010 |
3007 GenerateLoadArrayLength(masm(), rdx, rcx, &miss); | 3011 GenerateLoadArrayLength(masm(), rdx, rcx, &miss); |
3008 __ bind(&miss); | 3012 __ bind(&miss); |
3009 __ DecrementCounter(counters->keyed_load_array_length(), 1); | 3013 __ DecrementCounter(counters->keyed_load_array_length(), 1); |
3010 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 3014 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
3011 | 3015 |
3012 // Return the generated code. | 3016 // Return the generated code. |
3013 return GetCode(CALLBACKS, name); | 3017 return GetCode(Code::CALLBACKS, name); |
3014 } | 3018 } |
3015 | 3019 |
3016 | 3020 |
3017 Handle<Code> KeyedLoadStubCompiler::CompileLoadStringLength( | 3021 Handle<Code> KeyedLoadStubCompiler::CompileLoadStringLength( |
3018 Handle<String> name) { | 3022 Handle<String> name) { |
3019 // ----------- S t a t e ------------- | 3023 // ----------- S t a t e ------------- |
3020 // -- rax : key | 3024 // -- rax : key |
3021 // -- rdx : receiver | 3025 // -- rdx : receiver |
3022 // -- rsp[0] : return address | 3026 // -- rsp[0] : return address |
3023 // ----------------------------------- | 3027 // ----------------------------------- |
3024 Label miss; | 3028 Label miss; |
3025 | 3029 |
3026 Counters* counters = isolate()->counters(); | 3030 Counters* counters = isolate()->counters(); |
3027 __ IncrementCounter(counters->keyed_load_string_length(), 1); | 3031 __ IncrementCounter(counters->keyed_load_string_length(), 1); |
3028 | 3032 |
3029 // Check that the name has not changed. | 3033 // Check that the name has not changed. |
3030 __ Cmp(rax, name); | 3034 __ Cmp(rax, name); |
3031 __ j(not_equal, &miss); | 3035 __ j(not_equal, &miss); |
3032 | 3036 |
3033 GenerateLoadStringLength(masm(), rdx, rcx, rbx, &miss, true); | 3037 GenerateLoadStringLength(masm(), rdx, rcx, rbx, &miss, true); |
3034 __ bind(&miss); | 3038 __ bind(&miss); |
3035 __ DecrementCounter(counters->keyed_load_string_length(), 1); | 3039 __ DecrementCounter(counters->keyed_load_string_length(), 1); |
3036 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 3040 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
3037 | 3041 |
3038 // Return the generated code. | 3042 // Return the generated code. |
3039 return GetCode(CALLBACKS, name); | 3043 return GetCode(Code::CALLBACKS, name); |
3040 } | 3044 } |
3041 | 3045 |
3042 | 3046 |
3043 Handle<Code> KeyedLoadStubCompiler::CompileLoadFunctionPrototype( | 3047 Handle<Code> KeyedLoadStubCompiler::CompileLoadFunctionPrototype( |
3044 Handle<String> name) { | 3048 Handle<String> name) { |
3045 // ----------- S t a t e ------------- | 3049 // ----------- S t a t e ------------- |
3046 // -- rax : key | 3050 // -- rax : key |
3047 // -- rdx : receiver | 3051 // -- rdx : receiver |
3048 // -- rsp[0] : return address | 3052 // -- rsp[0] : return address |
3049 // ----------------------------------- | 3053 // ----------------------------------- |
3050 Label miss; | 3054 Label miss; |
3051 | 3055 |
3052 Counters* counters = isolate()->counters(); | 3056 Counters* counters = isolate()->counters(); |
3053 __ IncrementCounter(counters->keyed_load_function_prototype(), 1); | 3057 __ IncrementCounter(counters->keyed_load_function_prototype(), 1); |
3054 | 3058 |
3055 // Check that the name has not changed. | 3059 // Check that the name has not changed. |
3056 __ Cmp(rax, name); | 3060 __ Cmp(rax, name); |
3057 __ j(not_equal, &miss); | 3061 __ j(not_equal, &miss); |
3058 | 3062 |
3059 GenerateLoadFunctionPrototype(masm(), rdx, rcx, rbx, &miss); | 3063 GenerateLoadFunctionPrototype(masm(), rdx, rcx, rbx, &miss); |
3060 __ bind(&miss); | 3064 __ bind(&miss); |
3061 __ DecrementCounter(counters->keyed_load_function_prototype(), 1); | 3065 __ DecrementCounter(counters->keyed_load_function_prototype(), 1); |
3062 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 3066 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
3063 | 3067 |
3064 // Return the generated code. | 3068 // Return the generated code. |
3065 return GetCode(CALLBACKS, name); | 3069 return GetCode(Code::CALLBACKS, name); |
3066 } | 3070 } |
3067 | 3071 |
3068 | 3072 |
3069 Handle<Code> KeyedLoadStubCompiler::CompileLoadElement( | 3073 Handle<Code> KeyedLoadStubCompiler::CompileLoadElement( |
3070 Handle<Map> receiver_map) { | 3074 Handle<Map> receiver_map) { |
3071 // ----------- S t a t e ------------- | 3075 // ----------- S t a t e ------------- |
3072 // -- rax : key | 3076 // -- rax : key |
3073 // -- rdx : receiver | 3077 // -- rdx : receiver |
3074 // -- rsp[0] : return address | 3078 // -- rsp[0] : return address |
3075 // ----------------------------------- | 3079 // ----------------------------------- |
3076 ElementsKind elements_kind = receiver_map->elements_kind(); | 3080 ElementsKind elements_kind = receiver_map->elements_kind(); |
3077 Handle<Code> stub = KeyedLoadElementStub(elements_kind).GetCode(); | 3081 Handle<Code> stub = KeyedLoadElementStub(elements_kind).GetCode(); |
3078 | 3082 |
3079 __ DispatchMap(rdx, receiver_map, stub, DO_SMI_CHECK); | 3083 __ DispatchMap(rdx, receiver_map, stub, DO_SMI_CHECK); |
3080 | 3084 |
3081 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Miss(); | 3085 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Miss(); |
3082 __ jmp(ic, RelocInfo::CODE_TARGET); | 3086 __ jmp(ic, RelocInfo::CODE_TARGET); |
3083 | 3087 |
3084 // Return the generated code. | 3088 // Return the generated code. |
3085 return GetCode(NORMAL, factory()->empty_string()); | 3089 return GetCode(Code::NORMAL, factory()->empty_string()); |
3086 } | 3090 } |
3087 | 3091 |
3088 | 3092 |
3089 Handle<Code> KeyedLoadStubCompiler::CompileLoadPolymorphic( | 3093 Handle<Code> KeyedLoadStubCompiler::CompileLoadPolymorphic( |
3090 MapHandleList* receiver_maps, | 3094 MapHandleList* receiver_maps, |
3091 CodeHandleList* handler_ics) { | 3095 CodeHandleList* handler_ics) { |
3092 // ----------- S t a t e ------------- | 3096 // ----------- S t a t e ------------- |
3093 // -- rax : key | 3097 // -- rax : key |
3094 // -- rdx : receiver | 3098 // -- rdx : receiver |
3095 // -- rsp[0] : return address | 3099 // -- rsp[0] : return address |
3096 // ----------------------------------- | 3100 // ----------------------------------- |
3097 Label miss; | 3101 Label miss; |
3098 __ JumpIfSmi(rdx, &miss); | 3102 __ JumpIfSmi(rdx, &miss); |
3099 | 3103 |
3100 Register map_reg = rbx; | 3104 Register map_reg = rbx; |
3101 __ movq(map_reg, FieldOperand(rdx, HeapObject::kMapOffset)); | 3105 __ movq(map_reg, FieldOperand(rdx, HeapObject::kMapOffset)); |
3102 int receiver_count = receiver_maps->length(); | 3106 int receiver_count = receiver_maps->length(); |
3103 for (int current = 0; current < receiver_count; ++current) { | 3107 for (int current = 0; current < receiver_count; ++current) { |
3104 // Check map and tail call if there's a match | 3108 // Check map and tail call if there's a match |
3105 __ Cmp(map_reg, receiver_maps->at(current)); | 3109 __ Cmp(map_reg, receiver_maps->at(current)); |
3106 __ j(equal, handler_ics->at(current), RelocInfo::CODE_TARGET); | 3110 __ j(equal, handler_ics->at(current), RelocInfo::CODE_TARGET); |
3107 } | 3111 } |
3108 | 3112 |
3109 __ bind(&miss); | 3113 __ bind(&miss); |
3110 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 3114 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
3111 | 3115 |
3112 // Return the generated code. | 3116 // Return the generated code. |
3113 return GetCode(NORMAL, factory()->empty_string(), MEGAMORPHIC); | 3117 return GetCode(Code::NORMAL, factory()->empty_string(), MEGAMORPHIC); |
3114 } | 3118 } |
3115 | 3119 |
3116 | 3120 |
3117 // Specialized stub for constructing objects from functions which only have only | 3121 // Specialized stub for constructing objects from functions which only have only |
3118 // simple assignments of the form this.x = ...; in their body. | 3122 // simple assignments of the form this.x = ...; in their body. |
3119 Handle<Code> ConstructStubCompiler::CompileConstructStub( | 3123 Handle<Code> ConstructStubCompiler::CompileConstructStub( |
3120 Handle<JSFunction> function) { | 3124 Handle<JSFunction> function) { |
3121 // ----------- S t a t e ------------- | 3125 // ----------- S t a t e ------------- |
3122 // -- rax : argc | 3126 // -- rax : argc |
3123 // -- rdi : constructor | 3127 // -- rdi : constructor |
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3996 __ jmp(ic_slow, RelocInfo::CODE_TARGET); | 4000 __ jmp(ic_slow, RelocInfo::CODE_TARGET); |
3997 } | 4001 } |
3998 } | 4002 } |
3999 | 4003 |
4000 | 4004 |
4001 #undef __ | 4005 #undef __ |
4002 | 4006 |
4003 } } // namespace v8::internal | 4007 } } // namespace v8::internal |
4004 | 4008 |
4005 #endif // V8_TARGET_ARCH_X64 | 4009 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |