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

Side by Side Diff: src/arm/full-codegen-arm.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/arm/code-stubs-arm.cc ('k') | src/arm/ic-arm.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 2165 matching lines...) Expand 10 before | Expand all | Expand 10 after
2176 // Non-initializing assignments to consts are ignored. 2176 // Non-initializing assignments to consts are ignored.
2177 } 2177 }
2178 2178
2179 2179
2180 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { 2180 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
2181 // Assignment to a property, using a named store IC. 2181 // Assignment to a property, using a named store IC.
2182 Property* prop = expr->target()->AsProperty(); 2182 Property* prop = expr->target()->AsProperty();
2183 ASSERT(prop != NULL); 2183 ASSERT(prop != NULL);
2184 ASSERT(prop->key()->AsLiteral() != NULL); 2184 ASSERT(prop->key()->AsLiteral() != NULL);
2185 2185
2186 // If the assignment starts a block of assignments to the same object,
2187 // change to slow case to avoid the quadratic behavior of repeatedly
2188 // adding fast properties.
2189 if (expr->starts_initialization_block()) {
2190 __ push(result_register());
2191 __ ldr(ip, MemOperand(sp, kPointerSize)); // Receiver is now under value.
2192 __ push(ip);
2193 __ CallRuntime(Runtime::kToSlowProperties, 1);
2194 __ pop(result_register());
2195 }
2196
2186 // Record source code position before IC call. 2197 // Record source code position before IC call.
2187 SetSourcePosition(expr->position()); 2198 SetSourcePosition(expr->position());
2188 __ mov(r2, Operand(prop->key()->AsLiteral()->handle())); 2199 __ mov(r2, Operand(prop->key()->AsLiteral()->handle()));
2189 __ pop(r1); 2200 // Load receiver to r1. Leave a copy in the stack if needed for turning the
2201 // receiver into fast case.
2202 if (expr->ends_initialization_block()) {
2203 __ ldr(r1, MemOperand(sp));
2204 } else {
2205 __ pop(r1);
2206 }
2190 2207
2191 Handle<Code> ic = is_classic_mode() 2208 Handle<Code> ic = is_classic_mode()
2192 ? isolate()->builtins()->StoreIC_Initialize() 2209 ? isolate()->builtins()->StoreIC_Initialize()
2193 : isolate()->builtins()->StoreIC_Initialize_Strict(); 2210 : isolate()->builtins()->StoreIC_Initialize_Strict();
2194 CallIC(ic, RelocInfo::CODE_TARGET, expr->AssignmentFeedbackId()); 2211 CallIC(ic, RelocInfo::CODE_TARGET, expr->AssignmentFeedbackId());
2195 2212
2213 // If the assignment ends an initialization block, revert to fast case.
2214 if (expr->ends_initialization_block()) {
2215 __ push(r0); // Result of assignment, saved even if not needed.
2216 // Receiver is under the result value.
2217 __ ldr(ip, MemOperand(sp, kPointerSize));
2218 __ push(ip);
2219 __ CallRuntime(Runtime::kToFastProperties, 1);
2220 __ pop(r0);
2221 __ Drop(1);
2222 }
2196 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 2223 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
2197 context()->Plug(r0); 2224 context()->Plug(r0);
2198 } 2225 }
2199 2226
2200 2227
2201 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { 2228 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
2202 // Assignment to a property, using a keyed store IC. 2229 // Assignment to a property, using a keyed store IC.
2203 2230
2231 // If the assignment starts a block of assignments to the same object,
2232 // change to slow case to avoid the quadratic behavior of repeatedly
2233 // adding fast properties.
2234 if (expr->starts_initialization_block()) {
2235 __ push(result_register());
2236 // Receiver is now under the key and value.
2237 __ ldr(ip, MemOperand(sp, 2 * kPointerSize));
2238 __ push(ip);
2239 __ CallRuntime(Runtime::kToSlowProperties, 1);
2240 __ pop(result_register());
2241 }
2242
2204 // Record source code position before IC call. 2243 // Record source code position before IC call.
2205 SetSourcePosition(expr->position()); 2244 SetSourcePosition(expr->position());
2206 __ pop(r1); // Key. 2245 __ pop(r1); // Key.
2207 __ pop(r2); 2246 // Load receiver to r2. Leave a copy in the stack if needed for turning the
2247 // receiver into fast case.
2248 if (expr->ends_initialization_block()) {
2249 __ ldr(r2, MemOperand(sp));
2250 } else {
2251 __ pop(r2);
2252 }
2208 2253
2209 Handle<Code> ic = is_classic_mode() 2254 Handle<Code> ic = is_classic_mode()
2210 ? isolate()->builtins()->KeyedStoreIC_Initialize() 2255 ? isolate()->builtins()->KeyedStoreIC_Initialize()
2211 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); 2256 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
2212 CallIC(ic, RelocInfo::CODE_TARGET, expr->AssignmentFeedbackId()); 2257 CallIC(ic, RelocInfo::CODE_TARGET, expr->AssignmentFeedbackId());
2213 2258
2259 // If the assignment ends an initialization block, revert to fast case.
2260 if (expr->ends_initialization_block()) {
2261 __ push(r0); // Result of assignment, saved even if not needed.
2262 // Receiver is under the result value.
2263 __ ldr(ip, MemOperand(sp, kPointerSize));
2264 __ push(ip);
2265 __ CallRuntime(Runtime::kToFastProperties, 1);
2266 __ pop(r0);
2267 __ Drop(1);
2268 }
2214 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 2269 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
2215 context()->Plug(r0); 2270 context()->Plug(r0);
2216 } 2271 }
2217 2272
2218 2273
2219 void FullCodeGenerator::VisitProperty(Property* expr) { 2274 void FullCodeGenerator::VisitProperty(Property* expr) {
2220 Comment cmnt(masm_, "[ Property"); 2275 Comment cmnt(masm_, "[ Property");
2221 Expression* key = expr->key(); 2276 Expression* key = expr->key();
2222 2277
2223 if (key->IsPropertyName()) { 2278 if (key->IsPropertyName()) {
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
2667 __ b(ne, if_true); 2722 __ b(ne, if_true);
2668 2723
2669 // Check for fast case object. Generate false result for slow case object. 2724 // Check for fast case object. Generate false result for slow case object.
2670 __ ldr(r2, FieldMemOperand(r0, JSObject::kPropertiesOffset)); 2725 __ ldr(r2, FieldMemOperand(r0, JSObject::kPropertiesOffset));
2671 __ ldr(r2, FieldMemOperand(r2, HeapObject::kMapOffset)); 2726 __ ldr(r2, FieldMemOperand(r2, HeapObject::kMapOffset));
2672 __ LoadRoot(ip, Heap::kHashTableMapRootIndex); 2727 __ LoadRoot(ip, Heap::kHashTableMapRootIndex);
2673 __ cmp(r2, ip); 2728 __ cmp(r2, ip);
2674 __ b(eq, if_false); 2729 __ b(eq, if_false);
2675 2730
2676 // Look for valueOf symbol in the descriptor array, and indicate false if 2731 // Look for valueOf symbol in the descriptor array, and indicate false if
2677 // found. Since we omit an enumeration index check, if it is added via a 2732 // found. The type is not checked, so if it is a transition it is a false
2678 // transition that shares its descriptor array, this is a false positive. 2733 // negative.
2679 Label entry, loop, done; 2734 __ LoadInstanceDescriptors(r1, r4, r3);
2680 2735 __ ldr(r3, FieldMemOperand(r4, FixedArray::kLengthOffset));
2681 // Skip loop if no descriptors are valid. 2736 // r4: descriptor array
2682 __ NumberOfOwnDescriptors(r3, r1); 2737 // r3: length of descriptor array
2683 __ cmp(r3, Operand(0)); 2738 // Calculate the end of the descriptor array.
2684 __ b(eq, &done);
2685
2686 __ LoadInstanceDescriptors(r1, r4, r2);
2687 // r4: descriptor array.
2688 // r3: valid entries in the descriptor array.
2689 STATIC_ASSERT(kSmiTag == 0); 2739 STATIC_ASSERT(kSmiTag == 0);
2690 STATIC_ASSERT(kSmiTagSize == 1); 2740 STATIC_ASSERT(kSmiTagSize == 1);
2691 STATIC_ASSERT(kPointerSize == 4); 2741 STATIC_ASSERT(kPointerSize == 4);
2692 __ mov(ip, Operand(DescriptorArray::kDescriptorSize)); 2742 __ add(r2, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
2693 __ mul(r3, r3, ip);
2694 // Calculate location of the first key name.
2695 __ add(r4, r4, Operand(DescriptorArray::kFirstOffset - kHeapObjectTag));
2696 // Calculate the end of the descriptor array.
2697 __ mov(r2, r4);
2698 __ add(r2, r2, Operand(r3, LSL, kPointerSizeLog2 - kSmiTagSize)); 2743 __ add(r2, r2, Operand(r3, LSL, kPointerSizeLog2 - kSmiTagSize));
2699 2744
2745 // Calculate location of the first key name.
2746 __ add(r4,
2747 r4,
2748 Operand(DescriptorArray::kFirstOffset - kHeapObjectTag));
2700 // Loop through all the keys in the descriptor array. If one of these is the 2749 // Loop through all the keys in the descriptor array. If one of these is the
2701 // symbol valueOf the result is false. 2750 // symbol valueOf the result is false.
2751 Label entry, loop;
2702 // The use of ip to store the valueOf symbol asumes that it is not otherwise 2752 // The use of ip to store the valueOf symbol asumes that it is not otherwise
2703 // used in the loop below. 2753 // used in the loop below.
2704 __ mov(ip, Operand(FACTORY->value_of_symbol())); 2754 __ mov(ip, Operand(FACTORY->value_of_symbol()));
2705 __ jmp(&entry); 2755 __ jmp(&entry);
2706 __ bind(&loop); 2756 __ bind(&loop);
2707 __ ldr(r3, MemOperand(r4, 0)); 2757 __ ldr(r3, MemOperand(r4, 0));
2708 __ cmp(r3, ip); 2758 __ cmp(r3, ip);
2709 __ b(eq, if_false); 2759 __ b(eq, if_false);
2710 __ add(r4, r4, Operand(DescriptorArray::kDescriptorSize * kPointerSize)); 2760 __ add(r4, r4, Operand(DescriptorArray::kDescriptorSize * kPointerSize));
2711 __ bind(&entry); 2761 __ bind(&entry);
2712 __ cmp(r4, Operand(r2)); 2762 __ cmp(r4, Operand(r2));
2713 __ b(ne, &loop); 2763 __ b(ne, &loop);
2714 2764
2715 __ bind(&done); 2765 // If a valueOf property is not found on the object check that it's
2716 // If a valueOf property is not found on the object check that its
2717 // prototype is the un-modified String prototype. If not result is false. 2766 // prototype is the un-modified String prototype. If not result is false.
2718 __ ldr(r2, FieldMemOperand(r1, Map::kPrototypeOffset)); 2767 __ ldr(r2, FieldMemOperand(r1, Map::kPrototypeOffset));
2719 __ JumpIfSmi(r2, if_false); 2768 __ JumpIfSmi(r2, if_false);
2720 __ ldr(r2, FieldMemOperand(r2, HeapObject::kMapOffset)); 2769 __ ldr(r2, FieldMemOperand(r2, HeapObject::kMapOffset));
2721 __ ldr(r3, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); 2770 __ ldr(r3, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX));
2722 __ ldr(r3, FieldMemOperand(r3, GlobalObject::kNativeContextOffset)); 2771 __ ldr(r3, FieldMemOperand(r3, GlobalObject::kNativeContextOffset));
2723 __ ldr(r3, ContextOperand(r3, Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX)); 2772 __ ldr(r3, ContextOperand(r3, Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX));
2724 __ cmp(r2, r3); 2773 __ cmp(r2, r3);
2725 __ b(ne, if_false); 2774 __ b(ne, if_false);
2726 2775
(...skipping 1802 matching lines...) Expand 10 before | Expand all | Expand 10 after
4529 *context_length = 0; 4578 *context_length = 0;
4530 return previous_; 4579 return previous_;
4531 } 4580 }
4532 4581
4533 4582
4534 #undef __ 4583 #undef __
4535 4584
4536 } } // namespace v8::internal 4585 } } // namespace v8::internal
4537 4586
4538 #endif // V8_TARGET_ARCH_ARM 4587 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/arm/ic-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698