| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 2044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2056 // Patch the receiver on the stack with the global proxy if | 2056 // Patch the receiver on the stack with the global proxy if |
| 2057 // necessary. | 2057 // necessary. |
| 2058 if (object->IsGlobalObject()) { | 2058 if (object->IsGlobalObject()) { |
| 2059 ASSERT(depth == kInvalidProtoDepth); | 2059 ASSERT(depth == kInvalidProtoDepth); |
| 2060 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); | 2060 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); |
| 2061 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); | 2061 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); |
| 2062 } | 2062 } |
| 2063 break; | 2063 break; |
| 2064 | 2064 |
| 2065 case STRING_CHECK: | 2065 case STRING_CHECK: |
| 2066 if (!function->IsBuiltin()) { | 2066 if (!function->IsBuiltin() && !function_info->strict_mode()) { |
| 2067 // Calling non-builtins with a value as receiver requires boxing. | 2067 // Calling non-strict non-builtins with a value as the receiver |
| 2068 // requires boxing. |
| 2068 __ jmp(&miss); | 2069 __ jmp(&miss); |
| 2069 } else { | 2070 } else { |
| 2070 // Check that the object is a two-byte string or a symbol. | 2071 // Check that the object is a two-byte string or a symbol. |
| 2071 __ CmpObjectType(rdx, FIRST_NONSTRING_TYPE, rax); | 2072 __ CmpObjectType(rdx, FIRST_NONSTRING_TYPE, rax); |
| 2072 __ j(above_equal, &miss); | 2073 __ j(above_equal, &miss); |
| 2073 // Check that the maps starting from the prototype haven't changed. | 2074 // Check that the maps starting from the prototype haven't changed. |
| 2074 GenerateDirectLoadGlobalFunctionPrototype( | 2075 GenerateDirectLoadGlobalFunctionPrototype( |
| 2075 masm(), Context::STRING_FUNCTION_INDEX, rax, &miss); | 2076 masm(), Context::STRING_FUNCTION_INDEX, rax, &miss); |
| 2076 CheckPrototypes(JSObject::cast(object->GetPrototype()), rax, holder, | 2077 CheckPrototypes(JSObject::cast(object->GetPrototype()), rax, holder, |
| 2077 rbx, rdx, rdi, name, &miss); | 2078 rbx, rdx, rdi, name, &miss); |
| 2078 } | 2079 } |
| 2079 break; | 2080 break; |
| 2080 | 2081 |
| 2081 case NUMBER_CHECK: { | 2082 case NUMBER_CHECK: { |
| 2082 if (!function->IsBuiltin()) { | 2083 if (!function->IsBuiltin() && !function_info->strict_mode()) { |
| 2083 // Calling non-builtins with a value as receiver requires boxing. | 2084 // Calling non-strict non-builtins with a value as the receiver |
| 2085 // requires boxing. |
| 2084 __ jmp(&miss); | 2086 __ jmp(&miss); |
| 2085 } else { | 2087 } else { |
| 2086 Label fast; | 2088 Label fast; |
| 2087 // Check that the object is a smi or a heap number. | 2089 // Check that the object is a smi or a heap number. |
| 2088 __ JumpIfSmi(rdx, &fast); | 2090 __ JumpIfSmi(rdx, &fast); |
| 2089 __ CmpObjectType(rdx, HEAP_NUMBER_TYPE, rax); | 2091 __ CmpObjectType(rdx, HEAP_NUMBER_TYPE, rax); |
| 2090 __ j(not_equal, &miss); | 2092 __ j(not_equal, &miss); |
| 2091 __ bind(&fast); | 2093 __ bind(&fast); |
| 2092 // Check that the maps starting from the prototype haven't changed. | 2094 // Check that the maps starting from the prototype haven't changed. |
| 2093 GenerateDirectLoadGlobalFunctionPrototype( | 2095 GenerateDirectLoadGlobalFunctionPrototype( |
| 2094 masm(), Context::NUMBER_FUNCTION_INDEX, rax, &miss); | 2096 masm(), Context::NUMBER_FUNCTION_INDEX, rax, &miss); |
| 2095 CheckPrototypes(JSObject::cast(object->GetPrototype()), rax, holder, | 2097 CheckPrototypes(JSObject::cast(object->GetPrototype()), rax, holder, |
| 2096 rbx, rdx, rdi, name, &miss); | 2098 rbx, rdx, rdi, name, &miss); |
| 2097 } | 2099 } |
| 2098 break; | 2100 break; |
| 2099 } | 2101 } |
| 2100 | 2102 |
| 2101 case BOOLEAN_CHECK: { | 2103 case BOOLEAN_CHECK: { |
| 2102 if (!function->IsBuiltin()) { | 2104 if (!function->IsBuiltin() && !function_info->strict_mode()) { |
| 2103 // Calling non-builtins with a value as receiver requires boxing. | 2105 // Calling non-strict non-builtins with a value as the receiver |
| 2106 // requires boxing. |
| 2104 __ jmp(&miss); | 2107 __ jmp(&miss); |
| 2105 } else { | 2108 } else { |
| 2106 Label fast; | 2109 Label fast; |
| 2107 // Check that the object is a boolean. | 2110 // Check that the object is a boolean. |
| 2108 __ CompareRoot(rdx, Heap::kTrueValueRootIndex); | 2111 __ CompareRoot(rdx, Heap::kTrueValueRootIndex); |
| 2109 __ j(equal, &fast); | 2112 __ j(equal, &fast); |
| 2110 __ CompareRoot(rdx, Heap::kFalseValueRootIndex); | 2113 __ CompareRoot(rdx, Heap::kFalseValueRootIndex); |
| 2111 __ j(not_equal, &miss); | 2114 __ j(not_equal, &miss); |
| 2112 __ bind(&fast); | 2115 __ bind(&fast); |
| 2113 // Check that the maps starting from the prototype haven't changed. | 2116 // Check that the maps starting from the prototype haven't changed. |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2403 } | 2406 } |
| 2404 | 2407 |
| 2405 // Stub never generated for non-global objects that require access | 2408 // Stub never generated for non-global objects that require access |
| 2406 // checks. | 2409 // checks. |
| 2407 ASSERT(receiver->IsJSGlobalProxy() || !receiver->IsAccessCheckNeeded()); | 2410 ASSERT(receiver->IsJSGlobalProxy() || !receiver->IsAccessCheckNeeded()); |
| 2408 | 2411 |
| 2409 __ pop(rbx); // remove the return address | 2412 __ pop(rbx); // remove the return address |
| 2410 __ push(rdx); // receiver | 2413 __ push(rdx); // receiver |
| 2411 __ push(rcx); // name | 2414 __ push(rcx); // name |
| 2412 __ push(rax); // value | 2415 __ push(rax); // value |
| 2416 __ Push(Smi::FromInt(strict_mode_)); |
| 2413 __ push(rbx); // restore return address | 2417 __ push(rbx); // restore return address |
| 2414 | 2418 |
| 2415 // Do tail-call to the runtime system. | 2419 // Do tail-call to the runtime system. |
| 2416 ExternalReference store_ic_property = | 2420 ExternalReference store_ic_property = |
| 2417 ExternalReference(IC_Utility(IC::kStoreInterceptorProperty)); | 2421 ExternalReference(IC_Utility(IC::kStoreInterceptorProperty)); |
| 2418 __ TailCallExternalReference(store_ic_property, 3, 1); | 2422 __ TailCallExternalReference(store_ic_property, 4, 1); |
| 2419 | 2423 |
| 2420 // Handle store cache miss. | 2424 // Handle store cache miss. |
| 2421 __ bind(&miss); | 2425 __ bind(&miss); |
| 2422 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 2426 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 2423 Builtins::StoreIC_Miss)); | 2427 Builtins::StoreIC_Miss)); |
| 2424 __ Jump(ic, RelocInfo::CODE_TARGET); | 2428 __ Jump(ic, RelocInfo::CODE_TARGET); |
| 2425 | 2429 |
| 2426 // Return the generated code. | 2430 // Return the generated code. |
| 2427 return GetCode(INTERCEPTOR, name); | 2431 return GetCode(INTERCEPTOR, name); |
| 2428 } | 2432 } |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2561 __ bind(&miss); | 2565 __ bind(&miss); |
| 2562 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 2566 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 2563 Builtins::KeyedStoreIC_Miss)); | 2567 Builtins::KeyedStoreIC_Miss)); |
| 2564 __ jmp(ic, RelocInfo::CODE_TARGET); | 2568 __ jmp(ic, RelocInfo::CODE_TARGET); |
| 2565 | 2569 |
| 2566 // Return the generated code. | 2570 // Return the generated code. |
| 2567 return GetCode(NORMAL, NULL); | 2571 return GetCode(NORMAL, NULL); |
| 2568 } | 2572 } |
| 2569 | 2573 |
| 2570 | 2574 |
| 2575 MaybeObject* KeyedStoreStubCompiler::CompileStorePixelArray( |
| 2576 JSObject* receiver) { |
| 2577 // ----------- S t a t e ------------- |
| 2578 // -- rax : value |
| 2579 // -- rcx : key |
| 2580 // -- rdx : receiver |
| 2581 // -- rsp[0] : return address |
| 2582 // ----------------------------------- |
| 2583 Label miss; |
| 2584 |
| 2585 // Check that the map matches. |
| 2586 __ CheckMap(rdx, Handle<Map>(receiver->map()), &miss, false); |
| 2587 |
| 2588 // Do the load. |
| 2589 GenerateFastPixelArrayStore(masm(), |
| 2590 rdx, |
| 2591 rcx, |
| 2592 rax, |
| 2593 rdi, |
| 2594 rbx, |
| 2595 true, |
| 2596 false, |
| 2597 &miss, |
| 2598 &miss, |
| 2599 NULL, |
| 2600 &miss); |
| 2601 |
| 2602 // Handle store cache miss. |
| 2603 __ bind(&miss); |
| 2604 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 2605 Builtins::KeyedStoreIC_Miss)); |
| 2606 __ jmp(ic, RelocInfo::CODE_TARGET); |
| 2607 |
| 2608 // Return the generated code. |
| 2609 return GetCode(NORMAL, NULL); |
| 2610 } |
| 2611 |
| 2612 |
| 2571 MaybeObject* LoadStubCompiler::CompileLoadNonexistent(String* name, | 2613 MaybeObject* LoadStubCompiler::CompileLoadNonexistent(String* name, |
| 2572 JSObject* object, | 2614 JSObject* object, |
| 2573 JSObject* last) { | 2615 JSObject* last) { |
| 2574 // ----------- S t a t e ------------- | 2616 // ----------- S t a t e ------------- |
| 2575 // -- rax : receiver | 2617 // -- rax : receiver |
| 2576 // -- rcx : name | 2618 // -- rcx : name |
| 2577 // -- rsp[0] : return address | 2619 // -- rsp[0] : return address |
| 2578 // ----------------------------------- | 2620 // ----------------------------------- |
| 2579 Label miss; | 2621 Label miss; |
| 2580 | 2622 |
| (...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3453 // -- rax : value | 3495 // -- rax : value |
| 3454 // -- rcx : key | 3496 // -- rcx : key |
| 3455 // -- rdx : receiver | 3497 // -- rdx : receiver |
| 3456 // -- rsp[0] : return address | 3498 // -- rsp[0] : return address |
| 3457 // ----------------------------------- | 3499 // ----------------------------------- |
| 3458 | 3500 |
| 3459 __ pop(rbx); | 3501 __ pop(rbx); |
| 3460 __ push(rdx); // receiver | 3502 __ push(rdx); // receiver |
| 3461 __ push(rcx); // key | 3503 __ push(rcx); // key |
| 3462 __ push(rax); // value | 3504 __ push(rax); // value |
| 3505 __ Push(Smi::FromInt(NONE)); // PropertyAttributes |
| 3506 __ Push(Smi::FromInt( |
| 3507 Code::ExtractExtraICStateFromFlags(flags) & kStrictMode)); |
| 3463 __ push(rbx); // return address | 3508 __ push(rbx); // return address |
| 3464 | 3509 |
| 3465 // Do tail-call to runtime routine. | 3510 // Do tail-call to runtime routine. |
| 3466 __ TailCallRuntime(Runtime::kSetProperty, 3, 1); | 3511 __ TailCallRuntime(Runtime::kSetProperty, 5, 1); |
| 3467 | 3512 |
| 3468 return GetCode(flags); | 3513 return GetCode(flags); |
| 3469 } | 3514 } |
| 3470 | 3515 |
| 3471 #undef __ | 3516 #undef __ |
| 3472 | 3517 |
| 3473 } } // namespace v8::internal | 3518 } } // namespace v8::internal |
| 3474 | 3519 |
| 3475 #endif // V8_TARGET_ARCH_X64 | 3520 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |