Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: src/ia32/full-codegen-ia32.cc

Issue 11028027: Revert trunk to bleeding_edge at r12484 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ia32/disasm-ia32.cc ('k') | src/ia32/ic-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2121 matching lines...) Expand 10 before | Expand all | Expand 10 after
2132 2132
2133 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { 2133 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
2134 // Assignment to a property, using a named store IC. 2134 // Assignment to a property, using a named store IC.
2135 // eax : value 2135 // eax : value
2136 // esp[0] : receiver 2136 // esp[0] : receiver
2137 2137
2138 Property* prop = expr->target()->AsProperty(); 2138 Property* prop = expr->target()->AsProperty();
2139 ASSERT(prop != NULL); 2139 ASSERT(prop != NULL);
2140 ASSERT(prop->key()->AsLiteral() != NULL); 2140 ASSERT(prop->key()->AsLiteral() != NULL);
2141 2141
2142 // If the assignment starts a block of assignments to the same object,
2143 // change to slow case to avoid the quadratic behavior of repeatedly
2144 // adding fast properties.
2145 if (expr->starts_initialization_block()) {
2146 __ push(result_register());
2147 __ push(Operand(esp, kPointerSize)); // Receiver is now under value.
2148 __ CallRuntime(Runtime::kToSlowProperties, 1);
2149 __ pop(result_register());
2150 }
2151
2142 // Record source code position before IC call. 2152 // Record source code position before IC call.
2143 SetSourcePosition(expr->position()); 2153 SetSourcePosition(expr->position());
2144 __ mov(ecx, prop->key()->AsLiteral()->handle()); 2154 __ mov(ecx, prop->key()->AsLiteral()->handle());
2145 __ pop(edx); 2155 if (expr->ends_initialization_block()) {
2156 __ mov(edx, Operand(esp, 0));
2157 } else {
2158 __ pop(edx);
2159 }
2146 Handle<Code> ic = is_classic_mode() 2160 Handle<Code> ic = is_classic_mode()
2147 ? isolate()->builtins()->StoreIC_Initialize() 2161 ? isolate()->builtins()->StoreIC_Initialize()
2148 : isolate()->builtins()->StoreIC_Initialize_Strict(); 2162 : isolate()->builtins()->StoreIC_Initialize_Strict();
2149 CallIC(ic, RelocInfo::CODE_TARGET, expr->AssignmentFeedbackId()); 2163 CallIC(ic, RelocInfo::CODE_TARGET, expr->AssignmentFeedbackId());
2150 2164
2165 // If the assignment ends an initialization block, revert to fast case.
2166 if (expr->ends_initialization_block()) {
2167 __ push(eax); // Result of assignment, saved even if not needed.
2168 __ push(Operand(esp, kPointerSize)); // Receiver is under value.
2169 __ CallRuntime(Runtime::kToFastProperties, 1);
2170 __ pop(eax);
2171 __ Drop(1);
2172 }
2151 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 2173 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
2152 context()->Plug(eax); 2174 context()->Plug(eax);
2153 } 2175 }
2154 2176
2155 2177
2156 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { 2178 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
2157 // Assignment to a property, using a keyed store IC. 2179 // Assignment to a property, using a keyed store IC.
2158 // eax : value 2180 // eax : value
2159 // esp[0] : key 2181 // esp[0] : key
2160 // esp[kPointerSize] : receiver 2182 // esp[kPointerSize] : receiver
2161 2183
2184 // If the assignment starts a block of assignments to the same object,
2185 // change to slow case to avoid the quadratic behavior of repeatedly
2186 // adding fast properties.
2187 if (expr->starts_initialization_block()) {
2188 __ push(result_register());
2189 // Receiver is now under the key and value.
2190 __ push(Operand(esp, 2 * kPointerSize));
2191 __ CallRuntime(Runtime::kToSlowProperties, 1);
2192 __ pop(result_register());
2193 }
2194
2162 __ pop(ecx); // Key. 2195 __ pop(ecx); // Key.
2163 __ pop(edx); 2196 if (expr->ends_initialization_block()) {
2197 __ mov(edx, Operand(esp, 0)); // Leave receiver on the stack for later.
2198 } else {
2199 __ pop(edx);
2200 }
2164 // Record source code position before IC call. 2201 // Record source code position before IC call.
2165 SetSourcePosition(expr->position()); 2202 SetSourcePosition(expr->position());
2166 Handle<Code> ic = is_classic_mode() 2203 Handle<Code> ic = is_classic_mode()
2167 ? isolate()->builtins()->KeyedStoreIC_Initialize() 2204 ? isolate()->builtins()->KeyedStoreIC_Initialize()
2168 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); 2205 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
2169 CallIC(ic, RelocInfo::CODE_TARGET, expr->AssignmentFeedbackId()); 2206 CallIC(ic, RelocInfo::CODE_TARGET, expr->AssignmentFeedbackId());
2170 2207
2208 // If the assignment ends an initialization block, revert to fast case.
2209 if (expr->ends_initialization_block()) {
2210 __ pop(edx);
2211 __ push(eax); // Result of assignment, saved even if not needed.
2212 __ push(edx);
2213 __ CallRuntime(Runtime::kToFastProperties, 1);
2214 __ pop(eax);
2215 }
2216
2171 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 2217 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
2172 context()->Plug(eax); 2218 context()->Plug(eax);
2173 } 2219 }
2174 2220
2175 2221
2176 void FullCodeGenerator::VisitProperty(Property* expr) { 2222 void FullCodeGenerator::VisitProperty(Property* expr) {
2177 Comment cmnt(masm_, "[ Property"); 2223 Comment cmnt(masm_, "[ Property");
2178 Expression* key = expr->key(); 2224 Expression* key = expr->key();
2179 2225
2180 if (key->IsPropertyName()) { 2226 if (key->IsPropertyName()) {
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
2616 1 << Map::kStringWrapperSafeForDefaultValueOf); 2662 1 << Map::kStringWrapperSafeForDefaultValueOf);
2617 __ j(not_zero, if_true); 2663 __ j(not_zero, if_true);
2618 2664
2619 // Check for fast case object. Return false for slow case objects. 2665 // Check for fast case object. Return false for slow case objects.
2620 __ mov(ecx, FieldOperand(eax, JSObject::kPropertiesOffset)); 2666 __ mov(ecx, FieldOperand(eax, JSObject::kPropertiesOffset));
2621 __ mov(ecx, FieldOperand(ecx, HeapObject::kMapOffset)); 2667 __ mov(ecx, FieldOperand(ecx, HeapObject::kMapOffset));
2622 __ cmp(ecx, FACTORY->hash_table_map()); 2668 __ cmp(ecx, FACTORY->hash_table_map());
2623 __ j(equal, if_false); 2669 __ j(equal, if_false);
2624 2670
2625 // Look for valueOf symbol in the descriptor array, and indicate false if 2671 // Look for valueOf symbol in the descriptor array, and indicate false if
2626 // found. Since we omit an enumeration index check, if it is added via a 2672 // found. The type is not checked, so if it is a transition it is a false
2627 // transition that shares its descriptor array, this is a false positive. 2673 // negative.
2628 Label entry, loop, done;
2629
2630 // Skip loop if no descriptors are valid.
2631 __ NumberOfOwnDescriptors(ecx, ebx);
2632 __ cmp(ecx, 0);
2633 __ j(equal, &done);
2634
2635 __ LoadInstanceDescriptors(ebx, ebx); 2674 __ LoadInstanceDescriptors(ebx, ebx);
2636 // ebx: descriptor array. 2675 __ mov(ecx, FieldOperand(ebx, FixedArray::kLengthOffset));
2637 // ecx: valid entries in the descriptor array. 2676 // ebx: descriptor array
2677 // ecx: length of descriptor array
2638 // Calculate the end of the descriptor array. 2678 // Calculate the end of the descriptor array.
2639 STATIC_ASSERT(kSmiTag == 0); 2679 STATIC_ASSERT(kSmiTag == 0);
2640 STATIC_ASSERT(kSmiTagSize == 1); 2680 STATIC_ASSERT(kSmiTagSize == 1);
2641 STATIC_ASSERT(kPointerSize == 4); 2681 STATIC_ASSERT(kPointerSize == 4);
2642 __ imul(ecx, ecx, DescriptorArray::kDescriptorSize); 2682 __ lea(ecx, Operand(ebx, ecx, times_2, FixedArray::kHeaderSize));
2643 __ lea(ecx, Operand(ebx, ecx, times_2, DescriptorArray::kFirstOffset));
2644 // Calculate location of the first key name. 2683 // Calculate location of the first key name.
2645 __ add(ebx, Immediate(DescriptorArray::kFirstOffset)); 2684 __ add(ebx, Immediate(DescriptorArray::kFirstOffset));
2646 // Loop through all the keys in the descriptor array. If one of these is the 2685 // Loop through all the keys in the descriptor array. If one of these is the
2647 // symbol valueOf the result is false. 2686 // symbol valueOf the result is false.
2687 Label entry, loop;
2648 __ jmp(&entry); 2688 __ jmp(&entry);
2649 __ bind(&loop); 2689 __ bind(&loop);
2650 __ mov(edx, FieldOperand(ebx, 0)); 2690 __ mov(edx, FieldOperand(ebx, 0));
2651 __ cmp(edx, FACTORY->value_of_symbol()); 2691 __ cmp(edx, FACTORY->value_of_symbol());
2652 __ j(equal, if_false); 2692 __ j(equal, if_false);
2653 __ add(ebx, Immediate(DescriptorArray::kDescriptorSize * kPointerSize)); 2693 __ add(ebx, Immediate(DescriptorArray::kDescriptorSize * kPointerSize));
2654 __ bind(&entry); 2694 __ bind(&entry);
2655 __ cmp(ebx, ecx); 2695 __ cmp(ebx, ecx);
2656 __ j(not_equal, &loop); 2696 __ j(not_equal, &loop);
2657 2697
2658 __ bind(&done);
2659
2660 // Reload map as register ebx was used as temporary above. 2698 // Reload map as register ebx was used as temporary above.
2661 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset)); 2699 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset));
2662 2700
2663 // If a valueOf property is not found on the object check that its 2701 // If a valueOf property is not found on the object check that it's
2664 // prototype is the un-modified String prototype. If not result is false. 2702 // prototype is the un-modified String prototype. If not result is false.
2665 __ mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset)); 2703 __ mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset));
2666 __ JumpIfSmi(ecx, if_false); 2704 __ JumpIfSmi(ecx, if_false);
2667 __ mov(ecx, FieldOperand(ecx, HeapObject::kMapOffset)); 2705 __ mov(ecx, FieldOperand(ecx, HeapObject::kMapOffset));
2668 __ mov(edx, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); 2706 __ mov(edx, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
2669 __ mov(edx, 2707 __ mov(edx,
2670 FieldOperand(edx, GlobalObject::kNativeContextOffset)); 2708 FieldOperand(edx, GlobalObject::kNativeContextOffset));
2671 __ cmp(ecx, 2709 __ cmp(ecx,
2672 ContextOperand(edx, 2710 ContextOperand(edx,
2673 Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX)); 2711 Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX));
(...skipping 1843 matching lines...) Expand 10 before | Expand all | Expand 10 after
4517 *stack_depth = 0; 4555 *stack_depth = 0;
4518 *context_length = 0; 4556 *context_length = 0;
4519 return previous_; 4557 return previous_;
4520 } 4558 }
4521 4559
4522 #undef __ 4560 #undef __
4523 4561
4524 } } // namespace v8::internal 4562 } } // namespace v8::internal
4525 4563
4526 #endif // V8_TARGET_ARCH_IA32 4564 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/disasm-ia32.cc ('k') | src/ia32/ic-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698