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

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

Issue 11035053: Rollback trunk to bleeding_edge revision 12525 (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/mips/code-stubs-mips.cc ('k') | src/mips/lithium-mips.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 2190 matching lines...) Expand 10 before | Expand all | Expand 10 after
2201 // Non-initializing assignments to consts are ignored. 2201 // Non-initializing assignments to consts are ignored.
2202 } 2202 }
2203 2203
2204 2204
2205 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { 2205 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
2206 // Assignment to a property, using a named store IC. 2206 // Assignment to a property, using a named store IC.
2207 Property* prop = expr->target()->AsProperty(); 2207 Property* prop = expr->target()->AsProperty();
2208 ASSERT(prop != NULL); 2208 ASSERT(prop != NULL);
2209 ASSERT(prop->key()->AsLiteral() != NULL); 2209 ASSERT(prop->key()->AsLiteral() != NULL);
2210 2210
2211 // If the assignment starts a block of assignments to the same object,
2212 // change to slow case to avoid the quadratic behavior of repeatedly
2213 // adding fast properties.
2214 if (expr->starts_initialization_block()) {
2215 __ push(result_register());
2216 __ lw(t0, MemOperand(sp, kPointerSize)); // Receiver is now under value.
2217 __ push(t0);
2218 __ CallRuntime(Runtime::kToSlowProperties, 1);
2219 __ pop(result_register());
2220 }
2221
2211 // Record source code position before IC call. 2222 // Record source code position before IC call.
2212 SetSourcePosition(expr->position()); 2223 SetSourcePosition(expr->position());
2213 __ mov(a0, result_register()); // Load the value. 2224 __ mov(a0, result_register()); // Load the value.
2214 __ li(a2, Operand(prop->key()->AsLiteral()->handle())); 2225 __ li(a2, Operand(prop->key()->AsLiteral()->handle()));
2215 __ pop(a1); 2226 // Load receiver to a1. Leave a copy in the stack if needed for turning the
2227 // receiver into fast case.
2228 if (expr->ends_initialization_block()) {
2229 __ lw(a1, MemOperand(sp));
2230 } else {
2231 __ pop(a1);
2232 }
2216 2233
2217 Handle<Code> ic = is_classic_mode() 2234 Handle<Code> ic = is_classic_mode()
2218 ? isolate()->builtins()->StoreIC_Initialize() 2235 ? isolate()->builtins()->StoreIC_Initialize()
2219 : isolate()->builtins()->StoreIC_Initialize_Strict(); 2236 : isolate()->builtins()->StoreIC_Initialize_Strict();
2220 CallIC(ic, RelocInfo::CODE_TARGET, expr->AssignmentFeedbackId()); 2237 CallIC(ic, RelocInfo::CODE_TARGET, expr->AssignmentFeedbackId());
2221 2238
2239 // If the assignment ends an initialization block, revert to fast case.
2240 if (expr->ends_initialization_block()) {
2241 __ push(v0); // Result of assignment, saved even if not needed.
2242 // Receiver is under the result value.
2243 __ lw(t0, MemOperand(sp, kPointerSize));
2244 __ push(t0);
2245 __ CallRuntime(Runtime::kToFastProperties, 1);
2246 __ pop(v0);
2247 __ Drop(1);
2248 }
2222 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 2249 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
2223 context()->Plug(v0); 2250 context()->Plug(v0);
2224 } 2251 }
2225 2252
2226 2253
2227 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { 2254 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
2228 // Assignment to a property, using a keyed store IC. 2255 // Assignment to a property, using a keyed store IC.
2229 2256
2257 // If the assignment starts a block of assignments to the same object,
2258 // change to slow case to avoid the quadratic behavior of repeatedly
2259 // adding fast properties.
2260 if (expr->starts_initialization_block()) {
2261 __ push(result_register());
2262 // Receiver is now under the key and value.
2263 __ lw(t0, MemOperand(sp, 2 * kPointerSize));
2264 __ push(t0);
2265 __ CallRuntime(Runtime::kToSlowProperties, 1);
2266 __ pop(result_register());
2267 }
2268
2230 // Record source code position before IC call. 2269 // Record source code position before IC call.
2231 SetSourcePosition(expr->position()); 2270 SetSourcePosition(expr->position());
2232 // Call keyed store IC. 2271 // Call keyed store IC.
2233 // The arguments are: 2272 // The arguments are:
2234 // - a0 is the value, 2273 // - a0 is the value,
2235 // - a1 is the key, 2274 // - a1 is the key,
2236 // - a2 is the receiver. 2275 // - a2 is the receiver.
2237 __ mov(a0, result_register()); 2276 __ mov(a0, result_register());
2238 __ pop(a1); // Key. 2277 __ pop(a1); // Key.
2239 __ pop(a2); 2278 // Load receiver to a2. Leave a copy in the stack if needed for turning the
2279 // receiver into fast case.
2280 if (expr->ends_initialization_block()) {
2281 __ lw(a2, MemOperand(sp));
2282 } else {
2283 __ pop(a2);
2284 }
2240 2285
2241 Handle<Code> ic = is_classic_mode() 2286 Handle<Code> ic = is_classic_mode()
2242 ? isolate()->builtins()->KeyedStoreIC_Initialize() 2287 ? isolate()->builtins()->KeyedStoreIC_Initialize()
2243 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); 2288 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
2244 CallIC(ic, RelocInfo::CODE_TARGET, expr->AssignmentFeedbackId()); 2289 CallIC(ic, RelocInfo::CODE_TARGET, expr->AssignmentFeedbackId());
2245 2290
2291 // If the assignment ends an initialization block, revert to fast case.
2292 if (expr->ends_initialization_block()) {
2293 __ push(v0); // Result of assignment, saved even if not needed.
2294 // Receiver is under the result value.
2295 __ lw(t0, MemOperand(sp, kPointerSize));
2296 __ push(t0);
2297 __ CallRuntime(Runtime::kToFastProperties, 1);
2298 __ pop(v0);
2299 __ Drop(1);
2300 }
2246 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 2301 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
2247 context()->Plug(v0); 2302 context()->Plug(v0);
2248 } 2303 }
2249 2304
2250 2305
2251 void FullCodeGenerator::VisitProperty(Property* expr) { 2306 void FullCodeGenerator::VisitProperty(Property* expr) {
2252 Comment cmnt(masm_, "[ Property"); 2307 Comment cmnt(masm_, "[ Property");
2253 Expression* key = expr->key(); 2308 Expression* key = expr->key();
2254 2309
2255 if (key->IsPropertyName()) { 2310 if (key->IsPropertyName()) {
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
2697 __ And(t0, t0, 1 << Map::kStringWrapperSafeForDefaultValueOf); 2752 __ And(t0, t0, 1 << Map::kStringWrapperSafeForDefaultValueOf);
2698 __ Branch(if_true, ne, t0, Operand(zero_reg)); 2753 __ Branch(if_true, ne, t0, Operand(zero_reg));
2699 2754
2700 // Check for fast case object. Generate false result for slow case object. 2755 // Check for fast case object. Generate false result for slow case object.
2701 __ lw(a2, FieldMemOperand(v0, JSObject::kPropertiesOffset)); 2756 __ lw(a2, FieldMemOperand(v0, JSObject::kPropertiesOffset));
2702 __ lw(a2, FieldMemOperand(a2, HeapObject::kMapOffset)); 2757 __ lw(a2, FieldMemOperand(a2, HeapObject::kMapOffset));
2703 __ LoadRoot(t0, Heap::kHashTableMapRootIndex); 2758 __ LoadRoot(t0, Heap::kHashTableMapRootIndex);
2704 __ Branch(if_false, eq, a2, Operand(t0)); 2759 __ Branch(if_false, eq, a2, Operand(t0));
2705 2760
2706 // Look for valueOf symbol in the descriptor array, and indicate false if 2761 // Look for valueOf symbol in the descriptor array, and indicate false if
2707 // found. Since we omit an enumeration index check, if it is added via a 2762 // found. The type is not checked, so if it is a transition it is a false
2708 // transition that shares its descriptor array, this is a false positive. 2763 // negative.
2709 Label entry, loop, done; 2764 __ LoadInstanceDescriptors(a1, t0, a3);
2710 2765 __ lw(a3, FieldMemOperand(t0, FixedArray::kLengthOffset));
2711 // Skip loop if no descriptors are valid. 2766 // t0: descriptor array
2712 __ NumberOfOwnDescriptors(a3, a1); 2767 // a3: length of descriptor array
2713 __ Branch(&done, eq, a3, Operand(zero_reg)); 2768 // Calculate the end of the descriptor array.
2714
2715 __ LoadInstanceDescriptors(a1, t0, a2);
2716 // t0: descriptor array.
2717 // a3: valid entries in the descriptor array.
2718 STATIC_ASSERT(kSmiTag == 0); 2769 STATIC_ASSERT(kSmiTag == 0);
2719 STATIC_ASSERT(kSmiTagSize == 1); 2770 STATIC_ASSERT(kSmiTagSize == 1);
2720 STATIC_ASSERT(kPointerSize == 4); 2771 STATIC_ASSERT(kPointerSize == 4);
2721 __ li(at, Operand(DescriptorArray::kDescriptorSize)); 2772 __ Addu(a2, t0, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
2722 __ Mult(a3, at);
2723 // Calculate location of the first key name.
2724 __ Addu(t0, t0, Operand(DescriptorArray::kFirstOffset - kHeapObjectTag));
2725 // Calculate the end of the descriptor array.
2726 __ mov(a2, t0);
2727 __ sll(t1, a3, kPointerSizeLog2 - kSmiTagSize); 2773 __ sll(t1, a3, kPointerSizeLog2 - kSmiTagSize);
2728 __ Addu(a2, a2, t1); 2774 __ Addu(a2, a2, t1);
2729 2775
2776 // Calculate location of the first key name.
2777 __ Addu(t0,
2778 t0,
2779 Operand(DescriptorArray::kFirstOffset - kHeapObjectTag));
2730 // Loop through all the keys in the descriptor array. If one of these is the 2780 // Loop through all the keys in the descriptor array. If one of these is the
2731 // symbol valueOf the result is false. 2781 // symbol valueOf the result is false.
2782 Label entry, loop;
2732 // The use of t2 to store the valueOf symbol asumes that it is not otherwise 2783 // The use of t2 to store the valueOf symbol asumes that it is not otherwise
2733 // used in the loop below. 2784 // used in the loop below.
2734 __ LoadRoot(t2, Heap::kvalue_of_symbolRootIndex); 2785 __ LoadRoot(t2, Heap::kvalue_of_symbolRootIndex);
2735 __ jmp(&entry); 2786 __ jmp(&entry);
2736 __ bind(&loop); 2787 __ bind(&loop);
2737 __ lw(a3, MemOperand(t0, 0)); 2788 __ lw(a3, MemOperand(t0, 0));
2738 __ Branch(if_false, eq, a3, Operand(t2)); 2789 __ Branch(if_false, eq, a3, Operand(t2));
2739 __ Addu(t0, t0, Operand(DescriptorArray::kDescriptorSize * kPointerSize)); 2790 __ Addu(t0, t0, Operand(DescriptorArray::kDescriptorSize * kPointerSize));
2740 __ bind(&entry); 2791 __ bind(&entry);
2741 __ Branch(&loop, ne, t0, Operand(a2)); 2792 __ Branch(&loop, ne, t0, Operand(a2));
2742 2793
2743 __ bind(&done); 2794 // If a valueOf property is not found on the object check that it's
2744 // If a valueOf property is not found on the object check that its
2745 // prototype is the un-modified String prototype. If not result is false. 2795 // prototype is the un-modified String prototype. If not result is false.
2746 __ lw(a2, FieldMemOperand(a1, Map::kPrototypeOffset)); 2796 __ lw(a2, FieldMemOperand(a1, Map::kPrototypeOffset));
2747 __ JumpIfSmi(a2, if_false); 2797 __ JumpIfSmi(a2, if_false);
2748 __ lw(a2, FieldMemOperand(a2, HeapObject::kMapOffset)); 2798 __ lw(a2, FieldMemOperand(a2, HeapObject::kMapOffset));
2749 __ lw(a3, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); 2799 __ lw(a3, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX));
2750 __ lw(a3, FieldMemOperand(a3, GlobalObject::kNativeContextOffset)); 2800 __ lw(a3, FieldMemOperand(a3, GlobalObject::kNativeContextOffset));
2751 __ lw(a3, ContextOperand(a3, Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX)); 2801 __ lw(a3, ContextOperand(a3, Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX));
2752 __ Branch(if_false, ne, a2, Operand(a3)); 2802 __ Branch(if_false, ne, a2, Operand(a3));
2753 2803
2754 // Set the bit in the map to indicate that it has been checked safe for 2804 // Set the bit in the map to indicate that it has been checked safe for
(...skipping 1813 matching lines...) Expand 10 before | Expand all | Expand 10 after
4568 *context_length = 0; 4618 *context_length = 0;
4569 return previous_; 4619 return previous_;
4570 } 4620 }
4571 4621
4572 4622
4573 #undef __ 4623 #undef __
4574 4624
4575 } } // namespace v8::internal 4625 } } // namespace v8::internal
4576 4626
4577 #endif // V8_TARGET_ARCH_MIPS 4627 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | src/mips/lithium-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698