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

Side by Side Diff: src/mips64/ic-mips64.cc

Issue 371923006: Add mips64 port. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase Created 6 years, 5 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/mips64/full-codegen-mips64.cc ('k') | src/mips64/lithium-codegen-mips64.h » ('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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 5
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #if V8_TARGET_ARCH_MIPS 9 #if V8_TARGET_ARCH_MIPS64
10 10
11 #include "src/code-stubs.h" 11 #include "src/code-stubs.h"
12 #include "src/codegen.h" 12 #include "src/codegen.h"
13 #include "src/ic-inl.h" 13 #include "src/ic-inl.h"
14 #include "src/runtime.h" 14 #include "src/runtime.h"
15 #include "src/stub-cache.h" 15 #include "src/stub-cache.h"
16 16
17 namespace v8 { 17 namespace v8 {
18 namespace internal { 18 namespace internal {
19 19
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 STATIC_ASSERT(LAST_TYPE == LAST_SPEC_OBJECT_TYPE); 63 STATIC_ASSERT(LAST_TYPE == LAST_SPEC_OBJECT_TYPE);
64 64
65 GenerateGlobalInstanceTypeCheck(masm, scratch1, miss); 65 GenerateGlobalInstanceTypeCheck(masm, scratch1, miss);
66 66
67 // Check that the global object does not require access checks. 67 // Check that the global object does not require access checks.
68 __ lbu(scratch1, FieldMemOperand(scratch0, Map::kBitFieldOffset)); 68 __ lbu(scratch1, FieldMemOperand(scratch0, Map::kBitFieldOffset));
69 __ And(scratch1, scratch1, Operand((1 << Map::kIsAccessCheckNeeded) | 69 __ And(scratch1, scratch1, Operand((1 << Map::kIsAccessCheckNeeded) |
70 (1 << Map::kHasNamedInterceptor))); 70 (1 << Map::kHasNamedInterceptor)));
71 __ Branch(miss, ne, scratch1, Operand(zero_reg)); 71 __ Branch(miss, ne, scratch1, Operand(zero_reg));
72 72
73 __ lw(elements, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); 73 __ ld(elements, FieldMemOperand(receiver, JSObject::kPropertiesOffset));
74 __ lw(scratch1, FieldMemOperand(elements, HeapObject::kMapOffset)); 74 __ ld(scratch1, FieldMemOperand(elements, HeapObject::kMapOffset));
75 __ LoadRoot(scratch0, Heap::kHashTableMapRootIndex); 75 __ LoadRoot(scratch0, Heap::kHashTableMapRootIndex);
76 __ Branch(miss, ne, scratch1, Operand(scratch0)); 76 __ Branch(miss, ne, scratch1, Operand(scratch0));
77 } 77 }
78 78
79 79
80 // Helper function used from LoadIC GenerateNormal. 80 // Helper function used from LoadIC GenerateNormal.
81 // 81 //
82 // elements: Property dictionary. It is not clobbered if a jump to the miss 82 // elements: Property dictionary. It is not clobbered if a jump to the miss
83 // label is done. 83 // label is done.
84 // name: Property name. It is not clobbered if a jump to the miss label is 84 // name: Property name. It is not clobbered if a jump to the miss label is
(...skipping 28 matching lines...) Expand all
113 name, 113 name,
114 scratch1, 114 scratch1,
115 scratch2); 115 scratch2);
116 116
117 // If probing finds an entry check that the value is a normal 117 // If probing finds an entry check that the value is a normal
118 // property. 118 // property.
119 __ bind(&done); // scratch2 == elements + 4 * index. 119 __ bind(&done); // scratch2 == elements + 4 * index.
120 const int kElementsStartOffset = NameDictionary::kHeaderSize + 120 const int kElementsStartOffset = NameDictionary::kHeaderSize +
121 NameDictionary::kElementsStartIndex * kPointerSize; 121 NameDictionary::kElementsStartIndex * kPointerSize;
122 const int kDetailsOffset = kElementsStartOffset + 2 * kPointerSize; 122 const int kDetailsOffset = kElementsStartOffset + 2 * kPointerSize;
123 __ lw(scratch1, FieldMemOperand(scratch2, kDetailsOffset)); 123 __ ld(scratch1, FieldMemOperand(scratch2, kDetailsOffset));
124 __ And(at, 124 __ And(at,
125 scratch1, 125 scratch1,
126 Operand(PropertyDetails::TypeField::kMask << kSmiTagSize)); 126 Operand(Smi::FromInt(PropertyDetails::TypeField::kMask)));
127 __ Branch(miss, ne, at, Operand(zero_reg)); 127 __ Branch(miss, ne, at, Operand(zero_reg));
128 128
129 // Get the value at the masked, scaled index and return. 129 // Get the value at the masked, scaled index and return.
130 __ lw(result, 130 __ ld(result,
131 FieldMemOperand(scratch2, kElementsStartOffset + 1 * kPointerSize)); 131 FieldMemOperand(scratch2, kElementsStartOffset + 1 * kPointerSize));
132 } 132 }
133 133
134 134
135 // Helper function used from StoreIC::GenerateNormal. 135 // Helper function used from StoreIC::GenerateNormal.
136 // 136 //
137 // elements: Property dictionary. It is not clobbered if a jump to the miss 137 // elements: Property dictionary. It is not clobbered if a jump to the miss
138 // label is done. 138 // label is done.
139 // name: Property name. It is not clobbered if a jump to the miss label is 139 // name: Property name. It is not clobbered if a jump to the miss label is
140 // done 140 // done
(...skipping 27 matching lines...) Expand all
168 scratch2); 168 scratch2);
169 169
170 // If probing finds an entry in the dictionary check that the value 170 // If probing finds an entry in the dictionary check that the value
171 // is a normal property that is not read only. 171 // is a normal property that is not read only.
172 __ bind(&done); // scratch2 == elements + 4 * index. 172 __ bind(&done); // scratch2 == elements + 4 * index.
173 const int kElementsStartOffset = NameDictionary::kHeaderSize + 173 const int kElementsStartOffset = NameDictionary::kHeaderSize +
174 NameDictionary::kElementsStartIndex * kPointerSize; 174 NameDictionary::kElementsStartIndex * kPointerSize;
175 const int kDetailsOffset = kElementsStartOffset + 2 * kPointerSize; 175 const int kDetailsOffset = kElementsStartOffset + 2 * kPointerSize;
176 const int kTypeAndReadOnlyMask = 176 const int kTypeAndReadOnlyMask =
177 (PropertyDetails::TypeField::kMask | 177 (PropertyDetails::TypeField::kMask |
178 PropertyDetails::AttributesField::encode(READ_ONLY)) << kSmiTagSize; 178 PropertyDetails::AttributesField::encode(READ_ONLY));
179 __ lw(scratch1, FieldMemOperand(scratch2, kDetailsOffset)); 179 __ ld(scratch1, FieldMemOperand(scratch2, kDetailsOffset));
180 __ And(at, scratch1, Operand(kTypeAndReadOnlyMask)); 180 __ And(at, scratch1, Operand(Smi::FromInt(kTypeAndReadOnlyMask)));
181 __ Branch(miss, ne, at, Operand(zero_reg)); 181 __ Branch(miss, ne, at, Operand(zero_reg));
182 182
183 // Store the value at the masked, scaled index and return. 183 // Store the value at the masked, scaled index and return.
184 const int kValueOffset = kElementsStartOffset + kPointerSize; 184 const int kValueOffset = kElementsStartOffset + kPointerSize;
185 __ Addu(scratch2, scratch2, Operand(kValueOffset - kHeapObjectTag)); 185 __ Daddu(scratch2, scratch2, Operand(kValueOffset - kHeapObjectTag));
186 __ sw(value, MemOperand(scratch2)); 186 __ sd(value, MemOperand(scratch2));
187 187
188 // Update the write barrier. Make sure not to clobber the value. 188 // Update the write barrier. Make sure not to clobber the value.
189 __ mov(scratch1, value); 189 __ mov(scratch1, value);
190 __ RecordWrite( 190 __ RecordWrite(
191 elements, scratch2, scratch1, kRAHasNotBeenSaved, kDontSaveFPRegs); 191 elements, scratch2, scratch1, kRAHasNotBeenSaved, kDontSaveFPRegs);
192 } 192 }
193 193
194 194
195 // Checks the receiver for special cases (value type, slow case bits). 195 // Checks the receiver for special cases (value type, slow case bits).
196 // Falls through for regular JS object. 196 // Falls through for regular JS object.
197 static void GenerateKeyedLoadReceiverCheck(MacroAssembler* masm, 197 static void GenerateKeyedLoadReceiverCheck(MacroAssembler* masm,
198 Register receiver, 198 Register receiver,
199 Register map, 199 Register map,
200 Register scratch, 200 Register scratch,
201 int interceptor_bit, 201 int interceptor_bit,
202 Label* slow) { 202 Label* slow) {
203 // Check that the object isn't a smi. 203 // Check that the object isn't a smi.
204 __ JumpIfSmi(receiver, slow); 204 __ JumpIfSmi(receiver, slow);
205 // Get the map of the receiver. 205 // Get the map of the receiver.
206 __ lw(map, FieldMemOperand(receiver, HeapObject::kMapOffset)); 206 __ ld(map, FieldMemOperand(receiver, HeapObject::kMapOffset));
207 // Check bit field. 207 // Check bit field.
208 __ lbu(scratch, FieldMemOperand(map, Map::kBitFieldOffset)); 208 __ lbu(scratch, FieldMemOperand(map, Map::kBitFieldOffset));
209 __ And(at, scratch, 209 __ And(at, scratch,
210 Operand((1 << Map::kIsAccessCheckNeeded) | (1 << interceptor_bit))); 210 Operand((1 << Map::kIsAccessCheckNeeded) | (1 << interceptor_bit)));
211 __ Branch(slow, ne, at, Operand(zero_reg)); 211 __ Branch(slow, ne, at, Operand(zero_reg));
212 // Check that the object is some kind of JS object EXCEPT JS Value type. 212 // Check that the object is some kind of JS object EXCEPT JS Value type.
213 // In the case that the object is a value-wrapper object, 213 // In the case that the object is a value-wrapper object,
214 // we enter the runtime system to make sure that indexing into string 214 // we enter the runtime system to make sure that indexing into string
215 // objects work as intended. 215 // objects work as intended.
216 ASSERT(JS_OBJECT_TYPE > JS_VALUE_TYPE); 216 ASSERT(JS_OBJECT_TYPE > JS_VALUE_TYPE);
(...skipping 28 matching lines...) Expand all
245 // Unchanged on bailout so 'receiver' and 'key' can be safely 245 // Unchanged on bailout so 'receiver' and 'key' can be safely
246 // used by further computation. 246 // used by further computation.
247 // 247 //
248 // Scratch registers: 248 // Scratch registers:
249 // 249 //
250 // scratch1 - used to hold elements map and elements length. 250 // scratch1 - used to hold elements map and elements length.
251 // Holds the elements map if not_fast_array branch is taken. 251 // Holds the elements map if not_fast_array branch is taken.
252 // 252 //
253 // scratch2 - used to hold the loaded value. 253 // scratch2 - used to hold the loaded value.
254 254
255 __ lw(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); 255 __ ld(elements, FieldMemOperand(receiver, JSObject::kElementsOffset));
256 if (not_fast_array != NULL) { 256 if (not_fast_array != NULL) {
257 // Check that the object is in fast mode (not dictionary). 257 // Check that the object is in fast mode (not dictionary).
258 __ lw(scratch1, FieldMemOperand(elements, HeapObject::kMapOffset)); 258 __ ld(scratch1, FieldMemOperand(elements, HeapObject::kMapOffset));
259 __ LoadRoot(at, Heap::kFixedArrayMapRootIndex); 259 __ LoadRoot(at, Heap::kFixedArrayMapRootIndex);
260 __ Branch(not_fast_array, ne, scratch1, Operand(at)); 260 __ Branch(not_fast_array, ne, scratch1, Operand(at));
261 } else { 261 } else {
262 __ AssertFastElements(elements); 262 __ AssertFastElements(elements);
263 } 263 }
264 264
265 // Check that the key (index) is within bounds. 265 // Check that the key (index) is within bounds.
266 __ lw(scratch1, FieldMemOperand(elements, FixedArray::kLengthOffset)); 266 __ ld(scratch1, FieldMemOperand(elements, FixedArray::kLengthOffset));
267 __ Branch(out_of_range, hs, key, Operand(scratch1)); 267 __ Branch(out_of_range, hs, key, Operand(scratch1));
268 268
269 // Fast case: Do the load. 269 // Fast case: Do the load.
270 __ Addu(scratch1, elements, 270 __ Daddu(scratch1, elements,
271 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 271 Operand(FixedArray::kHeaderSize - kHeapObjectTag));
272 // The key is a smi. 272 // The key is a smi.
273 STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize < kPointerSizeLog2); 273 STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize < kPointerSizeLog2);
274 __ sll(at, key, kPointerSizeLog2 - kSmiTagSize); 274 __ SmiScale(at, key, kPointerSizeLog2);
275 __ addu(at, at, scratch1); 275 __ daddu(at, at, scratch1);
276 __ lw(scratch2, MemOperand(at)); 276 __ ld(scratch2, MemOperand(at));
277 277
278 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); 278 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
279 // In case the loaded value is the_hole we have to consult GetProperty 279 // In case the loaded value is the_hole we have to consult GetProperty
280 // to ensure the prototype chain is searched. 280 // to ensure the prototype chain is searched.
281 __ Branch(out_of_range, eq, scratch2, Operand(at)); 281 __ Branch(out_of_range, eq, scratch2, Operand(at));
282 __ mov(result, scratch2); 282 __ mov(result, scratch2);
283 } 283 }
284 284
285 285
286 // Checks whether a key is an array index string or a unique name. 286 // Checks whether a key is an array index string or a unique name.
287 // Falls through if a key is a unique name. 287 // Falls through if a key is a unique name.
288 static void GenerateKeyNameCheck(MacroAssembler* masm, 288 static void GenerateKeyNameCheck(MacroAssembler* masm,
289 Register key, 289 Register key,
290 Register map, 290 Register map,
291 Register hash, 291 Register hash,
292 Label* index_string, 292 Label* index_string,
293 Label* not_unique) { 293 Label* not_unique) {
294 // The key is not a smi. 294 // The key is not a smi.
295 Label unique; 295 Label unique;
296 // Is it a name? 296 // Is it a name?
297 __ GetObjectType(key, map, hash); 297 __ GetObjectType(key, map, hash);
298 __ Branch(not_unique, hi, hash, Operand(LAST_UNIQUE_NAME_TYPE)); 298 __ Branch(not_unique, hi, hash, Operand(LAST_UNIQUE_NAME_TYPE));
299 STATIC_ASSERT(LAST_UNIQUE_NAME_TYPE == FIRST_NONSTRING_TYPE); 299 STATIC_ASSERT(LAST_UNIQUE_NAME_TYPE == FIRST_NONSTRING_TYPE);
300 __ Branch(&unique, eq, hash, Operand(LAST_UNIQUE_NAME_TYPE)); 300 __ Branch(&unique, eq, hash, Operand(LAST_UNIQUE_NAME_TYPE));
301 301
302 // Is the string an array index, with cached numeric value? 302 // Is the string an array index, with cached numeric value?
303 __ lw(hash, FieldMemOperand(key, Name::kHashFieldOffset)); 303 __ lwu(hash, FieldMemOperand(key, Name::kHashFieldOffset));
304 __ And(at, hash, Operand(Name::kContainsCachedArrayIndexMask)); 304 __ And(at, hash, Operand(Name::kContainsCachedArrayIndexMask));
305 __ Branch(index_string, eq, at, Operand(zero_reg)); 305 __ Branch(index_string, eq, at, Operand(zero_reg));
306 306
307 // Is the string internalized? We know it's a string, so a single 307 // Is the string internalized? We know it's a string, so a single
308 // bit test is enough. 308 // bit test is enough.
309 // map: key map 309 // map: key map
310 __ lbu(hash, FieldMemOperand(map, Map::kInstanceTypeOffset)); 310 __ lbu(hash, FieldMemOperand(map, Map::kInstanceTypeOffset));
311 STATIC_ASSERT(kInternalizedTag == 0); 311 STATIC_ASSERT(kInternalizedTag == 0);
312 __ And(at, hash, Operand(kIsNotInternalizedMask)); 312 __ And(at, hash, Operand(kIsNotInternalizedMask));
313 __ Branch(not_unique, ne, at, Operand(zero_reg)); 313 __ Branch(not_unique, ne, at, Operand(zero_reg));
314 314
315 __ bind(&unique); 315 __ bind(&unique);
316 } 316 }
317 317
318 318
319 void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { 319 void LoadIC::GenerateMegamorphic(MacroAssembler* masm) {
320 // The return address is in lr. 320 // The return address is in lr.
321 Register receiver = ReceiverRegister(); 321 Register receiver = ReceiverRegister();
322 Register name = NameRegister(); 322 Register name = NameRegister();
323 ASSERT(receiver.is(a1)); 323 ASSERT(receiver.is(a1));
324 ASSERT(name.is(a2)); 324 ASSERT(name.is(a2));
325 325
326 // Probe the stub cache. 326 // Probe the stub cache.
327 Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC); 327 Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC);
328 masm->isolate()->stub_cache()->GenerateProbe( 328 masm->isolate()->stub_cache()->GenerateProbe(
329 masm, flags, receiver, name, a3, t0, t1, t2); 329 masm, flags, receiver, name, a3, a4, a5, a6);
330 330
331 // Cache miss: Jump to runtime. 331 // Cache miss: Jump to runtime.
332 GenerateMiss(masm); 332 GenerateMiss(masm);
333 } 333 }
334 334
335 335
336 void LoadIC::GenerateNormal(MacroAssembler* masm) { 336 void LoadIC::GenerateNormal(MacroAssembler* masm) {
337 // ----------- S t a t e ------------- 337 // ----------- S t a t e -------------
338 // -- a2 : name 338 // -- a2 : name
339 // -- lr : return address 339 // -- lr : return address
340 // -- a1 : receiver 340 // -- a1 : receiver
341 // ----------------------------------- 341 // -----------------------------------
342 ASSERT(a1.is(ReceiverRegister())); 342 ASSERT(a1.is(ReceiverRegister()));
343 ASSERT(a2.is(NameRegister())); 343 ASSERT(a2.is(NameRegister()));
344 344
345 Label miss, slow; 345 Label miss, slow;
346 346
347 GenerateNameDictionaryReceiverCheck(masm, a1, a0, a3, t0, &miss); 347 GenerateNameDictionaryReceiverCheck(masm, a1, a0, a3, a4, &miss);
348 348
349 // a0: elements 349 // a0: elements
350 GenerateDictionaryLoad(masm, &slow, a0, a2, v0, a3, t0); 350 GenerateDictionaryLoad(masm, &slow, a0, a2, v0, a3, a4);
351 __ Ret(); 351 __ Ret();
352 352
353 // Dictionary load failed, go slow (but don't miss). 353 // Dictionary load failed, go slow (but don't miss).
354 __ bind(&slow); 354 __ bind(&slow);
355 GenerateRuntimeGetProperty(masm); 355 GenerateRuntimeGetProperty(masm);
356 356
357 // Cache miss: Jump to runtime. 357 // Cache miss: Jump to runtime.
358 __ bind(&miss); 358 __ bind(&miss);
359 GenerateMiss(masm); 359 GenerateMiss(masm);
360 } 360 }
361 361
362 362
363 // A register that isn't one of the parameters to the load ic. 363 // A register that isn't one of the parameters to the load ic.
364 static const Register LoadIC_TempRegister() { return a3; } 364 static const Register LoadIC_TempRegister() { return a3; }
365 365
366 366
367 void LoadIC::GenerateMiss(MacroAssembler* masm) { 367 void LoadIC::GenerateMiss(MacroAssembler* masm) {
368 // The return address is in ra. 368 // The return address is on the stack.
369 Isolate* isolate = masm->isolate(); 369 Isolate* isolate = masm->isolate();
370 370
371 __ IncrementCounter(isolate->counters()->keyed_load_miss(), 1, a3, t0); 371 __ IncrementCounter(isolate->counters()->keyed_load_miss(), 1, a3, a4);
372 372
373 __ mov(LoadIC_TempRegister(), ReceiverRegister()); 373 __ mov(LoadIC_TempRegister(), ReceiverRegister());
374 __ Push(LoadIC_TempRegister(), NameRegister()); 374 __ Push(LoadIC_TempRegister(), NameRegister());
375 375
376 // Perform tail call to the entry. 376 // Perform tail call to the entry.
377 ExternalReference ref = ExternalReference(IC_Utility(kLoadIC_Miss), isolate); 377 ExternalReference ref = ExternalReference(IC_Utility(kLoadIC_Miss), isolate);
378 __ TailCallExternalReference(ref, 2, 1); 378 __ TailCallExternalReference(ref, 2, 1);
379 } 379 }
380 380
381 381
(...skipping 19 matching lines...) Expand all
401 401
402 // Check that the receiver is a JSObject. Because of the map check 402 // Check that the receiver is a JSObject. Because of the map check
403 // later, we do not need to check for interceptors or whether it 403 // later, we do not need to check for interceptors or whether it
404 // requires access checks. 404 // requires access checks.
405 __ JumpIfSmi(object, slow_case); 405 __ JumpIfSmi(object, slow_case);
406 // Check that the object is some kind of JSObject. 406 // Check that the object is some kind of JSObject.
407 __ GetObjectType(object, scratch1, scratch2); 407 __ GetObjectType(object, scratch1, scratch2);
408 __ Branch(slow_case, lt, scratch2, Operand(FIRST_JS_RECEIVER_TYPE)); 408 __ Branch(slow_case, lt, scratch2, Operand(FIRST_JS_RECEIVER_TYPE));
409 409
410 // Check that the key is a positive smi. 410 // Check that the key is a positive smi.
411 __ And(scratch1, key, Operand(0x80000001)); 411 __ NonNegativeSmiTst(key, scratch1);
412 __ Branch(slow_case, ne, scratch1, Operand(zero_reg)); 412 __ Branch(slow_case, ne, scratch1, Operand(zero_reg));
413 413
414 // Load the elements into scratch1 and check its map. 414 // Load the elements into scratch1 and check its map.
415 Handle<Map> arguments_map(heap->sloppy_arguments_elements_map()); 415 Handle<Map> arguments_map(heap->sloppy_arguments_elements_map());
416 __ lw(scratch1, FieldMemOperand(object, JSObject::kElementsOffset)); 416 __ ld(scratch1, FieldMemOperand(object, JSObject::kElementsOffset));
417 __ CheckMap(scratch1, 417 __ CheckMap(scratch1,
418 scratch2, 418 scratch2,
419 arguments_map, 419 arguments_map,
420 slow_case, 420 slow_case,
421 DONT_DO_SMI_CHECK); 421 DONT_DO_SMI_CHECK);
422 // Check if element is in the range of mapped arguments. If not, jump 422 // Check if element is in the range of mapped arguments. If not, jump
423 // to the unmapped lookup with the parameter map in scratch1. 423 // to the unmapped lookup with the parameter map in scratch1.
424 __ lw(scratch2, FieldMemOperand(scratch1, FixedArray::kLengthOffset)); 424 __ ld(scratch2, FieldMemOperand(scratch1, FixedArray::kLengthOffset));
425 __ Subu(scratch2, scratch2, Operand(Smi::FromInt(2))); 425 __ Dsubu(scratch2, scratch2, Operand(Smi::FromInt(2)));
426 __ Branch(unmapped_case, Ugreater_equal, key, Operand(scratch2)); 426 __ Branch(unmapped_case, Ugreater_equal, key, Operand(scratch2));
427 427
428 // Load element index and check whether it is the hole. 428 // Load element index and check whether it is the hole.
429 const int kOffset = 429 const int kOffset =
430 FixedArray::kHeaderSize + 2 * kPointerSize - kHeapObjectTag; 430 FixedArray::kHeaderSize + 2 * kPointerSize - kHeapObjectTag;
431 431
432 __ li(scratch3, Operand(kPointerSize >> 1)); 432 __ SmiUntag(scratch3, key);
433 __ Mul(scratch3, key, scratch3); 433 __ dsll(scratch3, scratch3, kPointerSizeLog2);
434 __ Addu(scratch3, scratch3, Operand(kOffset)); 434 __ Daddu(scratch3, scratch3, Operand(kOffset));
435 435
436 __ Addu(scratch2, scratch1, scratch3); 436 __ Daddu(scratch2, scratch1, scratch3);
437 __ lw(scratch2, MemOperand(scratch2)); 437 __ ld(scratch2, MemOperand(scratch2));
438 __ LoadRoot(scratch3, Heap::kTheHoleValueRootIndex); 438 __ LoadRoot(scratch3, Heap::kTheHoleValueRootIndex);
439 __ Branch(unmapped_case, eq, scratch2, Operand(scratch3)); 439 __ Branch(unmapped_case, eq, scratch2, Operand(scratch3));
440 440
441 // Load value from context and return it. We can reuse scratch1 because 441 // Load value from context and return it. We can reuse scratch1 because
442 // we do not jump to the unmapped lookup (which requires the parameter 442 // we do not jump to the unmapped lookup (which requires the parameter
443 // map in scratch1). 443 // map in scratch1).
444 __ lw(scratch1, FieldMemOperand(scratch1, FixedArray::kHeaderSize)); 444 __ ld(scratch1, FieldMemOperand(scratch1, FixedArray::kHeaderSize));
445 __ li(scratch3, Operand(kPointerSize >> 1)); 445 __ SmiUntag(scratch3, scratch2);
446 __ Mul(scratch3, scratch2, scratch3); 446 __ dsll(scratch3, scratch3, kPointerSizeLog2);
447 __ Addu(scratch3, scratch3, Operand(Context::kHeaderSize - kHeapObjectTag)); 447 __ Daddu(scratch3, scratch3, Operand(Context::kHeaderSize - kHeapObjectTag));
448 __ Addu(scratch2, scratch1, scratch3); 448 __ Daddu(scratch2, scratch1, scratch3);
449 return MemOperand(scratch2); 449 return MemOperand(scratch2);
450 } 450 }
451 451
452 452
453 static MemOperand GenerateUnmappedArgumentsLookup(MacroAssembler* masm, 453 static MemOperand GenerateUnmappedArgumentsLookup(MacroAssembler* masm,
454 Register key, 454 Register key,
455 Register parameter_map, 455 Register parameter_map,
456 Register scratch, 456 Register scratch,
457 Label* slow_case) { 457 Label* slow_case) {
458 // Element is in arguments backing store, which is referenced by the 458 // Element is in arguments backing store, which is referenced by the
459 // second element of the parameter_map. The parameter_map register 459 // second element of the parameter_map. The parameter_map register
460 // must be loaded with the parameter map of the arguments object and is 460 // must be loaded with the parameter map of the arguments object and is
461 // overwritten. 461 // overwritten.
462 const int kBackingStoreOffset = FixedArray::kHeaderSize + kPointerSize; 462 const int kBackingStoreOffset = FixedArray::kHeaderSize + kPointerSize;
463 Register backing_store = parameter_map; 463 Register backing_store = parameter_map;
464 __ lw(backing_store, FieldMemOperand(parameter_map, kBackingStoreOffset)); 464 __ ld(backing_store, FieldMemOperand(parameter_map, kBackingStoreOffset));
465 __ CheckMap(backing_store, 465 __ CheckMap(backing_store,
466 scratch, 466 scratch,
467 Heap::kFixedArrayMapRootIndex, 467 Heap::kFixedArrayMapRootIndex,
468 slow_case, 468 slow_case,
469 DONT_DO_SMI_CHECK); 469 DONT_DO_SMI_CHECK);
470 __ lw(scratch, FieldMemOperand(backing_store, FixedArray::kLengthOffset)); 470 __ ld(scratch, FieldMemOperand(backing_store, FixedArray::kLengthOffset));
471 __ Branch(slow_case, Ugreater_equal, key, Operand(scratch)); 471 __ Branch(slow_case, Ugreater_equal, key, Operand(scratch));
472 __ li(scratch, Operand(kPointerSize >> 1)); 472 __ SmiUntag(scratch, key);
473 __ Mul(scratch, key, scratch); 473 __ dsll(scratch, scratch, kPointerSizeLog2);
474 __ Addu(scratch, 474 __ Daddu(scratch,
475 scratch, 475 scratch,
476 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 476 Operand(FixedArray::kHeaderSize - kHeapObjectTag));
477 __ Addu(scratch, backing_store, scratch); 477 __ Daddu(scratch, backing_store, scratch);
478 return MemOperand(scratch); 478 return MemOperand(scratch);
479 } 479 }
480 480
481 481
482 void KeyedLoadIC::GenerateSloppyArguments(MacroAssembler* masm) { 482 void KeyedLoadIC::GenerateSloppyArguments(MacroAssembler* masm) {
483 // The return address is in ra. 483 // The return address is in ra.
484 Register receiver = ReceiverRegister(); 484 Register receiver = ReceiverRegister();
485 Register key = NameRegister(); 485 Register key = NameRegister();
486 ASSERT(receiver.is(a1)); 486 ASSERT(receiver.is(a1));
487 ASSERT(key.is(a2)); 487 ASSERT(key.is(a2));
488 488
489 Label slow, notin; 489 Label slow, notin;
490 MemOperand mapped_location = 490 MemOperand mapped_location =
491 GenerateMappedArgumentsLookup( 491 GenerateMappedArgumentsLookup(
492 masm, receiver, key, a0, a3, t0, &notin, &slow); 492 masm, receiver, key, a0, a3, a4, &notin, &slow);
493 __ Ret(USE_DELAY_SLOT); 493 __ Ret(USE_DELAY_SLOT);
494 __ lw(v0, mapped_location); 494 __ ld(v0, mapped_location);
495 __ bind(&notin); 495 __ bind(&notin);
496 // The unmapped lookup expects that the parameter map is in a0. 496 // The unmapped lookup expects that the parameter map is in a2.
497 MemOperand unmapped_location = 497 MemOperand unmapped_location =
498 GenerateUnmappedArgumentsLookup(masm, key, a0, a3, &slow); 498 GenerateUnmappedArgumentsLookup(masm, a0, a0, a3, &slow);
499 __ lw(a0, unmapped_location); 499 __ ld(a0, unmapped_location);
500 __ LoadRoot(a3, Heap::kTheHoleValueRootIndex); 500 __ LoadRoot(a3, Heap::kTheHoleValueRootIndex);
501 __ Branch(&slow, eq, a0, Operand(a3)); 501 __ Branch(&slow, eq, a0, Operand(a3));
502 __ Ret(USE_DELAY_SLOT); 502 __ Ret(USE_DELAY_SLOT);
503 __ mov(v0, a0); 503 __ mov(v0, a0);
504 __ bind(&slow); 504 __ bind(&slow);
505 GenerateMiss(masm); 505 GenerateMiss(masm);
506 } 506 }
507 507
508 508
509 void KeyedStoreIC::GenerateSloppyArguments(MacroAssembler* masm) { 509 void KeyedStoreIC::GenerateSloppyArguments(MacroAssembler* masm) {
510 // ---------- S t a t e -------------- 510 // ---------- S t a t e --------------
511 // -- a0 : value 511 // -- a0 : value
512 // -- a1 : key 512 // -- a1 : key
513 // -- a2 : receiver 513 // -- a2 : receiver
514 // -- lr : return address 514 // -- lr : return address
515 // ----------------------------------- 515 // -----------------------------------
516 Label slow, notin; 516 Label slow, notin;
517 // Store address is returned in register (of MemOperand) mapped_location. 517 // Store address is returned in register (of MemOperand) mapped_location.
518 MemOperand mapped_location = 518 MemOperand mapped_location =
519 GenerateMappedArgumentsLookup(masm, a2, a1, a3, t0, t1, &notin, &slow); 519 GenerateMappedArgumentsLookup(masm, a2, a1, a3, a4, a5, &notin, &slow);
520 __ sw(a0, mapped_location); 520 __ sd(a0, mapped_location);
521 __ mov(t5, a0); 521 __ mov(t1, a0);
522 ASSERT_EQ(mapped_location.offset(), 0); 522 ASSERT_EQ(mapped_location.offset(), 0);
523 __ RecordWrite(a3, mapped_location.rm(), t5, 523 __ RecordWrite(a3, mapped_location.rm(), t1,
524 kRAHasNotBeenSaved, kDontSaveFPRegs); 524 kRAHasNotBeenSaved, kDontSaveFPRegs);
525 __ Ret(USE_DELAY_SLOT); 525 __ Ret(USE_DELAY_SLOT);
526 __ mov(v0, a0); // (In delay slot) return the value stored in v0. 526 __ mov(v0, a0); // (In delay slot) return the value stored in v0.
527 __ bind(&notin); 527 __ bind(&notin);
528 // The unmapped lookup expects that the parameter map is in a3. 528 // The unmapped lookup expects that the parameter map is in a3.
529 // Store address is returned in register (of MemOperand) unmapped_location. 529 // Store address is returned in register (of MemOperand) unmapped_location.
530 MemOperand unmapped_location = 530 MemOperand unmapped_location =
531 GenerateUnmappedArgumentsLookup(masm, a1, a3, t0, &slow); 531 GenerateUnmappedArgumentsLookup(masm, a1, a3, a4, &slow);
532 __ sw(a0, unmapped_location); 532 __ sd(a0, unmapped_location);
533 __ mov(t5, a0); 533 __ mov(t1, a0);
534 ASSERT_EQ(unmapped_location.offset(), 0); 534 ASSERT_EQ(unmapped_location.offset(), 0);
535 __ RecordWrite(a3, unmapped_location.rm(), t5, 535 __ RecordWrite(a3, unmapped_location.rm(), t1,
536 kRAHasNotBeenSaved, kDontSaveFPRegs); 536 kRAHasNotBeenSaved, kDontSaveFPRegs);
537 __ Ret(USE_DELAY_SLOT); 537 __ Ret(USE_DELAY_SLOT);
538 __ mov(v0, a0); // (In delay slot) return the value stored in v0. 538 __ mov(v0, a0); // (In delay slot) return the value stored in v0.
539 __ bind(&slow); 539 __ bind(&slow);
540 GenerateMiss(masm); 540 GenerateMiss(masm);
541 } 541 }
542 542
543 543
544 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { 544 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) {
545 // The return address is in ra. 545 // The return address is in ra.
546 Isolate* isolate = masm->isolate(); 546 Isolate* isolate = masm->isolate();
547 547
548 __ IncrementCounter(isolate->counters()->keyed_load_miss(), 1, a3, t0); 548 __ IncrementCounter(isolate->counters()->keyed_load_miss(), 1, a3, a4);
549 549
550 __ Push(ReceiverRegister(), NameRegister()); 550 __ Push(ReceiverRegister(), NameRegister());
551 551
552 // Perform tail call to the entry. 552 // Perform tail call to the entry.
553 ExternalReference ref = 553 ExternalReference ref =
554 ExternalReference(IC_Utility(kKeyedLoadIC_Miss), isolate); 554 ExternalReference(IC_Utility(kKeyedLoadIC_Miss), isolate);
555 555
556 __ TailCallExternalReference(ref, 2, 1); 556 __ TailCallExternalReference(ref, 2, 1);
557 } 557 }
558 558
(...skipping 30 matching lines...) Expand all
589 // Now the key is known to be a smi. This place is also jumped to from below 589 // Now the key is known to be a smi. This place is also jumped to from below
590 // where a numeric string is converted to a smi. 590 // where a numeric string is converted to a smi.
591 591
592 GenerateKeyedLoadReceiverCheck( 592 GenerateKeyedLoadReceiverCheck(
593 masm, receiver, a0, a3, Map::kHasIndexedInterceptor, &slow); 593 masm, receiver, a0, a3, Map::kHasIndexedInterceptor, &slow);
594 594
595 // Check the receiver's map to see if it has fast elements. 595 // Check the receiver's map to see if it has fast elements.
596 __ CheckFastElements(a0, a3, &check_number_dictionary); 596 __ CheckFastElements(a0, a3, &check_number_dictionary);
597 597
598 GenerateFastArrayLoad( 598 GenerateFastArrayLoad(
599 masm, receiver, key, a0, a3, t0, v0, NULL, &slow); 599 masm, receiver, key, a0, a3, a4, v0, NULL, &slow);
600 __ IncrementCounter(isolate->counters()->keyed_load_generic_smi(), 1, t0, a3); 600 __ IncrementCounter(isolate->counters()->keyed_load_generic_smi(), 1, a4, a3);
601 __ Ret(); 601 __ Ret();
602 602
603 __ bind(&check_number_dictionary); 603 __ bind(&check_number_dictionary);
604 __ lw(t0, FieldMemOperand(receiver, JSObject::kElementsOffset)); 604 __ ld(a4, FieldMemOperand(receiver, JSObject::kElementsOffset));
605 __ lw(a3, FieldMemOperand(t0, JSObject::kMapOffset)); 605 __ ld(a3, FieldMemOperand(a4, JSObject::kMapOffset));
606 606
607 // Check whether the elements is a number dictionary. 607 // Check whether the elements is a number dictionary.
608 // a3: elements map 608 // a3: elements map
609 // t0: elements 609 // a4: elements
610 __ LoadRoot(at, Heap::kHashTableMapRootIndex); 610 __ LoadRoot(at, Heap::kHashTableMapRootIndex);
611 __ Branch(&slow, ne, a3, Operand(at)); 611 __ Branch(&slow, ne, a3, Operand(at));
612 __ sra(a0, key, kSmiTagSize); 612 __ dsra32(a0, key, 0);
613 __ LoadFromNumberDictionary(&slow, t0, key, v0, a0, a3, t1); 613 __ LoadFromNumberDictionary(&slow, a4, key, v0, a0, a3, a5);
614 __ Ret(); 614 __ Ret();
615 615
616 // Slow case, key and receiver still in a2 and a1. 616 // Slow case, key and receiver still in a2 and a1.
617 __ bind(&slow); 617 __ bind(&slow);
618 __ IncrementCounter(isolate->counters()->keyed_load_generic_slow(), 618 __ IncrementCounter(isolate->counters()->keyed_load_generic_slow(),
619 1, 619 1,
620 t0, 620 a4,
621 a3); 621 a3);
622 GenerateRuntimeGetProperty(masm); 622 GenerateRuntimeGetProperty(masm);
623 623
624 __ bind(&check_name); 624 __ bind(&check_name);
625 GenerateKeyNameCheck(masm, key, a0, a3, &index_name, &slow); 625 GenerateKeyNameCheck(masm, key, a0, a3, &index_name, &slow);
626 626
627 GenerateKeyedLoadReceiverCheck( 627 GenerateKeyedLoadReceiverCheck(
628 masm, receiver, a0, a3, Map::kHasNamedInterceptor, &slow); 628 masm, receiver, a0, a3, Map::kHasNamedInterceptor, &slow);
629 629
630 630
631 // If the receiver is a fast-case object, check the keyed lookup 631 // If the receiver is a fast-case object, check the keyed lookup
632 // cache. Otherwise probe the dictionary. 632 // cache. Otherwise probe the dictionary.
633 __ lw(a3, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); 633 __ ld(a3, FieldMemOperand(receiver, JSObject::kPropertiesOffset));
634 __ lw(t0, FieldMemOperand(a3, HeapObject::kMapOffset)); 634 __ ld(a4, FieldMemOperand(a3, HeapObject::kMapOffset));
635 __ LoadRoot(at, Heap::kHashTableMapRootIndex); 635 __ LoadRoot(at, Heap::kHashTableMapRootIndex);
636 __ Branch(&probe_dictionary, eq, t0, Operand(at)); 636 __ Branch(&probe_dictionary, eq, a4, Operand(at));
637 637
638 // Load the map of the receiver, compute the keyed lookup cache hash 638 // Load the map of the receiver, compute the keyed lookup cache hash
639 // based on 32 bits of the map pointer and the name hash. 639 // based on 32 bits of the map pointer and the name hash.
640 __ lw(a0, FieldMemOperand(receiver, HeapObject::kMapOffset)); 640 __ ld(a0, FieldMemOperand(receiver, HeapObject::kMapOffset));
641 __ sra(a3, a0, KeyedLookupCache::kMapHashShift); 641 __ dsll32(a3, a0, 0);
642 __ lw(t0, FieldMemOperand(key, Name::kHashFieldOffset)); 642 __ dsrl32(a3, a3, 0);
643 __ sra(at, t0, Name::kHashShift); 643 __ dsra(a3, a3, KeyedLookupCache::kMapHashShift);
644 __ lwu(a4, FieldMemOperand(key, Name::kHashFieldOffset));
645 __ dsra(at, a4, Name::kHashShift);
644 __ xor_(a3, a3, at); 646 __ xor_(a3, a3, at);
645 int mask = KeyedLookupCache::kCapacityMask & KeyedLookupCache::kHashMask; 647 int mask = KeyedLookupCache::kCapacityMask & KeyedLookupCache::kHashMask;
646 __ And(a3, a3, Operand(mask)); 648 __ And(a3, a3, Operand(mask));
647 649
648 // Load the key (consisting of map and unique name) from the cache and 650 // Load the key (consisting of map and unique name) from the cache and
649 // check for match. 651 // check for match.
650 Label load_in_object_property; 652 Label load_in_object_property;
651 static const int kEntriesPerBucket = KeyedLookupCache::kEntriesPerBucket; 653 static const int kEntriesPerBucket = KeyedLookupCache::kEntriesPerBucket;
652 Label hit_on_nth_entry[kEntriesPerBucket]; 654 Label hit_on_nth_entry[kEntriesPerBucket];
653 ExternalReference cache_keys = 655 ExternalReference cache_keys =
654 ExternalReference::keyed_lookup_cache_keys(isolate); 656 ExternalReference::keyed_lookup_cache_keys(isolate);
655 __ li(t0, Operand(cache_keys)); 657 __ li(a4, Operand(cache_keys));
656 __ sll(at, a3, kPointerSizeLog2 + 1); 658 __ dsll(at, a3, kPointerSizeLog2 + 1);
657 __ addu(t0, t0, at); 659 __ daddu(a4, a4, at);
658 660
659 for (int i = 0; i < kEntriesPerBucket - 1; i++) { 661 for (int i = 0; i < kEntriesPerBucket - 1; i++) {
660 Label try_next_entry; 662 Label try_next_entry;
661 __ lw(t1, MemOperand(t0, kPointerSize * i * 2)); 663 __ ld(a5, MemOperand(a4, kPointerSize * i * 2));
662 __ Branch(&try_next_entry, ne, a0, Operand(t1)); 664 __ Branch(&try_next_entry, ne, a0, Operand(a5));
663 __ lw(t1, MemOperand(t0, kPointerSize * (i * 2 + 1))); 665 __ ld(a5, MemOperand(a4, kPointerSize * (i * 2 + 1)));
664 __ Branch(&hit_on_nth_entry[i], eq, key, Operand(t1)); 666 __ Branch(&hit_on_nth_entry[i], eq, key, Operand(a5));
665 __ bind(&try_next_entry); 667 __ bind(&try_next_entry);
666 } 668 }
667 669
668 __ lw(t1, MemOperand(t0, kPointerSize * (kEntriesPerBucket - 1) * 2)); 670 __ ld(a5, MemOperand(a4, kPointerSize * (kEntriesPerBucket - 1) * 2));
669 __ Branch(&slow, ne, a0, Operand(t1)); 671 __ Branch(&slow, ne, a0, Operand(a5));
670 __ lw(t1, MemOperand(t0, kPointerSize * ((kEntriesPerBucket - 1) * 2 + 1))); 672 __ ld(a5, MemOperand(a4, kPointerSize * ((kEntriesPerBucket - 1) * 2 + 1)));
671 __ Branch(&slow, ne, key, Operand(t1)); 673 __ Branch(&slow, ne, key, Operand(a5));
672 674
673 // Get field offset. 675 // Get field offset.
674 // a0 : receiver's map 676 // a0 : receiver's map
675 // a3 : lookup cache index 677 // a3 : lookup cache index
676 ExternalReference cache_field_offsets = 678 ExternalReference cache_field_offsets =
677 ExternalReference::keyed_lookup_cache_field_offsets(isolate); 679 ExternalReference::keyed_lookup_cache_field_offsets(isolate);
678 680
679 // Hit on nth entry. 681 // Hit on nth entry.
680 for (int i = kEntriesPerBucket - 1; i >= 0; i--) { 682 for (int i = kEntriesPerBucket - 1; i >= 0; i--) {
681 __ bind(&hit_on_nth_entry[i]); 683 __ bind(&hit_on_nth_entry[i]);
682 __ li(t0, Operand(cache_field_offsets)); 684 __ li(a4, Operand(cache_field_offsets));
683 __ sll(at, a3, kPointerSizeLog2); 685
684 __ addu(at, t0, at); 686 // TODO(yy) This data structure does NOT follow natural pointer size.
685 __ lw(t1, MemOperand(at, kPointerSize * i)); 687 __ dsll(at, a3, kPointerSizeLog2 - 1);
686 __ lbu(t2, FieldMemOperand(a0, Map::kInObjectPropertiesOffset)); 688 __ daddu(at, a4, at);
687 __ Subu(t1, t1, t2); 689 __ lwu(a5, MemOperand(at, kPointerSize / 2 * i));
688 __ Branch(&property_array_property, ge, t1, Operand(zero_reg)); 690
691 __ lbu(a6, FieldMemOperand(a0, Map::kInObjectPropertiesOffset));
692 __ Dsubu(a5, a5, a6);
693 __ Branch(&property_array_property, ge, a5, Operand(zero_reg));
689 if (i != 0) { 694 if (i != 0) {
690 __ Branch(&load_in_object_property); 695 __ Branch(&load_in_object_property);
691 } 696 }
692 } 697 }
693 698
694 // Load in-object property. 699 // Load in-object property.
695 __ bind(&load_in_object_property); 700 __ bind(&load_in_object_property);
696 __ lbu(t2, FieldMemOperand(a0, Map::kInstanceSizeOffset)); 701 __ lbu(a6, FieldMemOperand(a0, Map::kInstanceSizeOffset));
697 __ addu(t2, t2, t1); // Index from start of object. 702 // Index from start of object.
698 __ Subu(receiver, receiver, Operand(kHeapObjectTag)); // Remove the heap tag. 703 __ daddu(a6, a6, a5);
699 __ sll(at, t2, kPointerSizeLog2); 704 // Remove the heap tag.
700 __ addu(at, receiver, at); 705 __ Dsubu(receiver, receiver, Operand(kHeapObjectTag));
701 __ lw(v0, MemOperand(at)); 706 __ dsll(at, a6, kPointerSizeLog2);
707 __ daddu(at, receiver, at);
708 __ ld(v0, MemOperand(at));
702 __ IncrementCounter(isolate->counters()->keyed_load_generic_lookup_cache(), 709 __ IncrementCounter(isolate->counters()->keyed_load_generic_lookup_cache(),
703 1, 710 1,
704 t0, 711 a4,
705 a3); 712 a3);
706 __ Ret(); 713 __ Ret();
707 714
708 // Load property array property. 715 // Load property array property.
709 __ bind(&property_array_property); 716 __ bind(&property_array_property);
710 __ lw(receiver, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); 717 __ ld(receiver, FieldMemOperand(receiver, JSObject::kPropertiesOffset));
711 __ Addu(receiver, receiver, FixedArray::kHeaderSize - kHeapObjectTag); 718 __ Daddu(receiver, receiver, FixedArray::kHeaderSize - kHeapObjectTag);
712 __ sll(v0, t1, kPointerSizeLog2); 719 __ dsll(v0, a5, kPointerSizeLog2);
713 __ Addu(v0, v0, receiver); 720 __ Daddu(v0, v0, a1);
714 __ lw(v0, MemOperand(v0)); 721 __ ld(v0, MemOperand(v0));
715 __ IncrementCounter(isolate->counters()->keyed_load_generic_lookup_cache(), 722 __ IncrementCounter(isolate->counters()->keyed_load_generic_lookup_cache(),
716 1, 723 1,
717 t0, 724 a4,
718 a3); 725 a3);
719 __ Ret(); 726 __ Ret();
720 727
721 728
722 // Do a quick inline probe of the receiver's dictionary, if it 729 // Do a quick inline probe of the receiver's dictionary, if it
723 // exists. 730 // exists.
724 __ bind(&probe_dictionary); 731 __ bind(&probe_dictionary);
725 // a3: elements 732 // a3: elements
726 __ lw(a0, FieldMemOperand(receiver, HeapObject::kMapOffset)); 733 __ ld(a0, FieldMemOperand(receiver, HeapObject::kMapOffset));
727 __ lbu(a0, FieldMemOperand(a0, Map::kInstanceTypeOffset)); 734 __ lbu(a0, FieldMemOperand(a0, Map::kInstanceTypeOffset));
728 GenerateGlobalInstanceTypeCheck(masm, a0, &slow); 735 GenerateGlobalInstanceTypeCheck(masm, a0, &slow);
729 // Load the property to v0. 736 // Load the property to v0.
730 GenerateDictionaryLoad(masm, &slow, a3, key, v0, t1, t0); 737 GenerateDictionaryLoad(masm, &slow, a3, key, v0, a5, a4);
731 __ IncrementCounter(isolate->counters()->keyed_load_generic_symbol(), 738 __ IncrementCounter(isolate->counters()->keyed_load_generic_symbol(),
732 1, 739 1,
733 t0, 740 a4,
734 a3); 741 a3);
735 __ Ret(); 742 __ Ret();
736 743
737 __ bind(&index_name); 744 __ bind(&index_name);
738 __ IndexFromHash(a3, key); 745 __ IndexFromHash(a3, key);
739 // Now jump to the place where smi keys are handled. 746 // Now jump to the place where smi keys are handled.
740 __ Branch(&index_smi); 747 __ Branch(&index_smi);
741 } 748 }
742 749
743 750
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 Register receiver, 807 Register receiver,
801 Register receiver_map, 808 Register receiver_map,
802 Register elements_map, 809 Register elements_map,
803 Register elements) { 810 Register elements) {
804 Label transition_smi_elements; 811 Label transition_smi_elements;
805 Label finish_object_store, non_double_value, transition_double_elements; 812 Label finish_object_store, non_double_value, transition_double_elements;
806 Label fast_double_without_map_check; 813 Label fast_double_without_map_check;
807 814
808 // Fast case: Do the store, could be either Object or double. 815 // Fast case: Do the store, could be either Object or double.
809 __ bind(fast_object); 816 __ bind(fast_object);
810 Register scratch_value = t0; 817 Register scratch_value = a4;
811 Register address = t1; 818 Register address = a5;
812 if (check_map == kCheckMap) { 819 if (check_map == kCheckMap) {
813 __ lw(elements_map, FieldMemOperand(elements, HeapObject::kMapOffset)); 820 __ ld(elements_map, FieldMemOperand(elements, HeapObject::kMapOffset));
814 __ Branch(fast_double, ne, elements_map, 821 __ Branch(fast_double, ne, elements_map,
815 Operand(masm->isolate()->factory()->fixed_array_map())); 822 Operand(masm->isolate()->factory()->fixed_array_map()));
816 } 823 }
817 824
818 // HOLECHECK: guards "A[i] = V" 825 // HOLECHECK: guards "A[i] = V"
819 // We have to go to the runtime if the current value is the hole because 826 // We have to go to the runtime if the current value is the hole because
820 // there may be a callback on the element. 827 // there may be a callback on the element.
821 Label holecheck_passed1; 828 Label holecheck_passed1;
822 __ Addu(address, elements, FixedArray::kHeaderSize - kHeapObjectTag); 829 __ Daddu(address, elements, FixedArray::kHeaderSize - kHeapObjectTag);
823 __ sll(at, key, kPointerSizeLog2 - kSmiTagSize); 830 __ SmiScale(at, key, kPointerSizeLog2);
824 __ addu(address, address, at); 831 __ daddu(address, address, at);
825 __ lw(scratch_value, MemOperand(address)); 832 __ ld(scratch_value, MemOperand(address));
833
826 __ Branch(&holecheck_passed1, ne, scratch_value, 834 __ Branch(&holecheck_passed1, ne, scratch_value,
827 Operand(masm->isolate()->factory()->the_hole_value())); 835 Operand(masm->isolate()->factory()->the_hole_value()));
828 __ JumpIfDictionaryInPrototypeChain(receiver, elements_map, scratch_value, 836 __ JumpIfDictionaryInPrototypeChain(receiver, elements_map, scratch_value,
829 slow); 837 slow);
830 838
831 __ bind(&holecheck_passed1); 839 __ bind(&holecheck_passed1);
832 840
833 // Smi stores don't require further checks. 841 // Smi stores don't require further checks.
834 Label non_smi_value; 842 Label non_smi_value;
835 __ JumpIfNotSmi(value, &non_smi_value); 843 __ JumpIfNotSmi(value, &non_smi_value);
836 844
837 if (increment_length == kIncrementLength) { 845 if (increment_length == kIncrementLength) {
838 // Add 1 to receiver->length. 846 // Add 1 to receiver->length.
839 __ Addu(scratch_value, key, Operand(Smi::FromInt(1))); 847 __ Daddu(scratch_value, key, Operand(Smi::FromInt(1)));
840 __ sw(scratch_value, FieldMemOperand(receiver, JSArray::kLengthOffset)); 848 __ sd(scratch_value, FieldMemOperand(receiver, JSArray::kLengthOffset));
841 } 849 }
842 // It's irrelevant whether array is smi-only or not when writing a smi. 850 // It's irrelevant whether array is smi-only or not when writing a smi.
843 __ Addu(address, elements, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 851 __ Daddu(address, elements,
844 __ sll(scratch_value, key, kPointerSizeLog2 - kSmiTagSize); 852 Operand(FixedArray::kHeaderSize - kHeapObjectTag));
845 __ Addu(address, address, scratch_value); 853 __ SmiScale(scratch_value, key, kPointerSizeLog2);
846 __ sw(value, MemOperand(address)); 854 __ Daddu(address, address, scratch_value);
855 __ sd(value, MemOperand(address));
847 __ Ret(); 856 __ Ret();
848 857
849 __ bind(&non_smi_value); 858 __ bind(&non_smi_value);
850 // Escape to elements kind transition case. 859 // Escape to elements kind transition case.
851 __ CheckFastObjectElements(receiver_map, scratch_value, 860 __ CheckFastObjectElements(receiver_map, scratch_value,
852 &transition_smi_elements); 861 &transition_smi_elements);
853 862
854 // Fast elements array, store the value to the elements backing store. 863 // Fast elements array, store the value to the elements backing store.
855 __ bind(&finish_object_store); 864 __ bind(&finish_object_store);
856 if (increment_length == kIncrementLength) { 865 if (increment_length == kIncrementLength) {
857 // Add 1 to receiver->length. 866 // Add 1 to receiver->length.
858 __ Addu(scratch_value, key, Operand(Smi::FromInt(1))); 867 __ Daddu(scratch_value, key, Operand(Smi::FromInt(1)));
859 __ sw(scratch_value, FieldMemOperand(receiver, JSArray::kLengthOffset)); 868 __ sd(scratch_value, FieldMemOperand(receiver, JSArray::kLengthOffset));
860 } 869 }
861 __ Addu(address, elements, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 870 __ Daddu(address, elements,
862 __ sll(scratch_value, key, kPointerSizeLog2 - kSmiTagSize); 871 Operand(FixedArray::kHeaderSize - kHeapObjectTag));
863 __ Addu(address, address, scratch_value); 872 __ SmiScale(scratch_value, key, kPointerSizeLog2);
864 __ sw(value, MemOperand(address)); 873 __ Daddu(address, address, scratch_value);
874 __ sd(value, MemOperand(address));
865 // Update write barrier for the elements array address. 875 // Update write barrier for the elements array address.
866 __ mov(scratch_value, value); // Preserve the value which is returned. 876 __ mov(scratch_value, value); // Preserve the value which is returned.
867 __ RecordWrite(elements, 877 __ RecordWrite(elements,
868 address, 878 address,
869 scratch_value, 879 scratch_value,
870 kRAHasNotBeenSaved, 880 kRAHasNotBeenSaved,
871 kDontSaveFPRegs, 881 kDontSaveFPRegs,
872 EMIT_REMEMBERED_SET, 882 EMIT_REMEMBERED_SET,
873 OMIT_SMI_CHECK); 883 OMIT_SMI_CHECK);
874 __ Ret(); 884 __ Ret();
875 885
876 __ bind(fast_double); 886 __ bind(fast_double);
877 if (check_map == kCheckMap) { 887 if (check_map == kCheckMap) {
878 // Check for fast double array case. If this fails, call through to the 888 // Check for fast double array case. If this fails, call through to the
879 // runtime. 889 // runtime.
880 __ LoadRoot(at, Heap::kFixedDoubleArrayMapRootIndex); 890 __ LoadRoot(at, Heap::kFixedDoubleArrayMapRootIndex);
881 __ Branch(slow, ne, elements_map, Operand(at)); 891 __ Branch(slow, ne, elements_map, Operand(at));
882 } 892 }
883 893
884 // HOLECHECK: guards "A[i] double hole?" 894 // HOLECHECK: guards "A[i] double hole?"
885 // We have to see if the double version of the hole is present. If so 895 // We have to see if the double version of the hole is present. If so
886 // go to the runtime. 896 // go to the runtime.
887 __ Addu(address, elements, 897 __ Daddu(address, elements,
888 Operand(FixedDoubleArray::kHeaderSize + kHoleNanUpper32Offset 898 Operand(FixedDoubleArray::kHeaderSize + sizeof(kHoleNanLower32)
889 - kHeapObjectTag)); 899 - kHeapObjectTag));
890 __ sll(at, key, kPointerSizeLog2); 900 __ SmiScale(at, key, kPointerSizeLog2);
891 __ addu(address, address, at); 901 __ daddu(address, address, at);
892 __ lw(scratch_value, MemOperand(address)); 902 __ lw(scratch_value, MemOperand(address));
893 __ Branch(&fast_double_without_map_check, ne, scratch_value, 903 __ Branch(&fast_double_without_map_check, ne, scratch_value,
894 Operand(kHoleNanUpper32)); 904 Operand(kHoleNanUpper32));
895 __ JumpIfDictionaryInPrototypeChain(receiver, elements_map, scratch_value, 905 __ JumpIfDictionaryInPrototypeChain(receiver, elements_map, scratch_value,
896 slow); 906 slow);
897 907
898 __ bind(&fast_double_without_map_check); 908 __ bind(&fast_double_without_map_check);
899 __ StoreNumberToDoubleElements(value, 909 __ StoreNumberToDoubleElements(value,
900 key, 910 key,
901 elements, // Overwritten. 911 elements, // Overwritten.
902 a3, // Scratch regs... 912 a3, // Scratch regs...
903 t0, 913 a4,
904 t1, 914 a5,
905 &transition_double_elements); 915 &transition_double_elements);
906 if (increment_length == kIncrementLength) { 916 if (increment_length == kIncrementLength) {
907 // Add 1 to receiver->length. 917 // Add 1 to receiver->length.
908 __ Addu(scratch_value, key, Operand(Smi::FromInt(1))); 918 __ Daddu(scratch_value, key, Operand(Smi::FromInt(1)));
909 __ sw(scratch_value, FieldMemOperand(receiver, JSArray::kLengthOffset)); 919 __ sd(scratch_value, FieldMemOperand(receiver, JSArray::kLengthOffset));
910 } 920 }
911 __ Ret(); 921 __ Ret();
912 922
913 __ bind(&transition_smi_elements); 923 __ bind(&transition_smi_elements);
914 // Transition the array appropriately depending on the value type. 924 // Transition the array appropriately depending on the value type.
915 __ lw(t0, FieldMemOperand(value, HeapObject::kMapOffset)); 925 __ ld(a4, FieldMemOperand(value, HeapObject::kMapOffset));
916 __ LoadRoot(at, Heap::kHeapNumberMapRootIndex); 926 __ LoadRoot(at, Heap::kHeapNumberMapRootIndex);
917 __ Branch(&non_double_value, ne, t0, Operand(at)); 927 __ Branch(&non_double_value, ne, a4, Operand(at));
918 928
919 // Value is a double. Transition FAST_SMI_ELEMENTS -> 929 // Value is a double. Transition FAST_SMI_ELEMENTS ->
920 // FAST_DOUBLE_ELEMENTS and complete the store. 930 // FAST_DOUBLE_ELEMENTS and complete the store.
921 __ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS, 931 __ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS,
922 FAST_DOUBLE_ELEMENTS, 932 FAST_DOUBLE_ELEMENTS,
923 receiver_map, 933 receiver_map,
924 t0, 934 a4,
925 slow); 935 slow);
926 ASSERT(receiver_map.is(a3)); // Transition code expects map in a3 936 ASSERT(receiver_map.is(a3)); // Transition code expects map in a3
927 AllocationSiteMode mode = AllocationSite::GetMode(FAST_SMI_ELEMENTS, 937 AllocationSiteMode mode = AllocationSite::GetMode(FAST_SMI_ELEMENTS,
928 FAST_DOUBLE_ELEMENTS); 938 FAST_DOUBLE_ELEMENTS);
929 ElementsTransitionGenerator::GenerateSmiToDouble(masm, mode, slow); 939 ElementsTransitionGenerator::GenerateSmiToDouble(masm, mode, slow);
930 __ lw(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); 940 __ ld(elements, FieldMemOperand(receiver, JSObject::kElementsOffset));
931 __ jmp(&fast_double_without_map_check); 941 __ jmp(&fast_double_without_map_check);
932 942
933 __ bind(&non_double_value); 943 __ bind(&non_double_value);
934 // Value is not a double, FAST_SMI_ELEMENTS -> FAST_ELEMENTS 944 // Value is not a double, FAST_SMI_ELEMENTS -> FAST_ELEMENTS
935 __ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS, 945 __ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS,
936 FAST_ELEMENTS, 946 FAST_ELEMENTS,
937 receiver_map, 947 receiver_map,
938 t0, 948 a4,
939 slow); 949 slow);
940 ASSERT(receiver_map.is(a3)); // Transition code expects map in a3 950 ASSERT(receiver_map.is(a3)); // Transition code expects map in a3
941 mode = AllocationSite::GetMode(FAST_SMI_ELEMENTS, FAST_ELEMENTS); 951 mode = AllocationSite::GetMode(FAST_SMI_ELEMENTS, FAST_ELEMENTS);
942 ElementsTransitionGenerator::GenerateMapChangeElementsTransition(masm, mode, 952 ElementsTransitionGenerator::GenerateMapChangeElementsTransition(masm, mode,
943 slow); 953 slow);
944 __ lw(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); 954 __ ld(elements, FieldMemOperand(receiver, JSObject::kElementsOffset));
945 __ jmp(&finish_object_store); 955 __ jmp(&finish_object_store);
946 956
947 __ bind(&transition_double_elements); 957 __ bind(&transition_double_elements);
948 // Elements are FAST_DOUBLE_ELEMENTS, but value is an Object that's not a 958 // Elements are FAST_DOUBLE_ELEMENTS, but value is an Object that's not a
949 // HeapNumber. Make sure that the receiver is a Array with FAST_ELEMENTS and 959 // HeapNumber. Make sure that the receiver is a Array with FAST_ELEMENTS and
950 // transition array from FAST_DOUBLE_ELEMENTS to FAST_ELEMENTS 960 // transition array from FAST_DOUBLE_ELEMENTS to FAST_ELEMENTS
951 __ LoadTransitionedArrayMapConditional(FAST_DOUBLE_ELEMENTS, 961 __ LoadTransitionedArrayMapConditional(FAST_DOUBLE_ELEMENTS,
952 FAST_ELEMENTS, 962 FAST_ELEMENTS,
953 receiver_map, 963 receiver_map,
954 t0, 964 a4,
955 slow); 965 slow);
956 ASSERT(receiver_map.is(a3)); // Transition code expects map in a3 966 ASSERT(receiver_map.is(a3)); // Transition code expects map in a3
957 mode = AllocationSite::GetMode(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS); 967 mode = AllocationSite::GetMode(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS);
958 ElementsTransitionGenerator::GenerateDoubleToObject(masm, mode, slow); 968 ElementsTransitionGenerator::GenerateDoubleToObject(masm, mode, slow);
959 __ lw(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); 969 __ ld(elements, FieldMemOperand(receiver, JSObject::kElementsOffset));
960 __ jmp(&finish_object_store); 970 __ jmp(&finish_object_store);
961 } 971 }
962 972
963 973
964 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, 974 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm,
965 StrictMode strict_mode) { 975 StrictMode strict_mode) {
966 // ---------- S t a t e -------------- 976 // ---------- S t a t e --------------
967 // -- a0 : value 977 // -- a0 : value
968 // -- a1 : key 978 // -- a1 : key
969 // -- a2 : receiver 979 // -- a2 : receiver
970 // -- ra : return address 980 // -- ra : return address
971 // ----------------------------------- 981 // -----------------------------------
972 Label slow, fast_object, fast_object_grow; 982 Label slow, fast_object, fast_object_grow;
973 Label fast_double, fast_double_grow; 983 Label fast_double, fast_double_grow;
974 Label array, extra, check_if_double_array; 984 Label array, extra, check_if_double_array;
975 985
976 // Register usage. 986 // Register usage.
977 Register value = a0; 987 Register value = a0;
978 Register key = a1; 988 Register key = a1;
979 Register receiver = a2; 989 Register receiver = a2;
980 Register receiver_map = a3; 990 Register receiver_map = a3;
981 Register elements_map = t2; 991 Register elements_map = a6;
982 Register elements = t3; // Elements array of the receiver. 992 Register elements = a7; // Elements array of the receiver.
983 // t0 and t1 are used as general scratch registers. 993 // a4 and a5 are used as general scratch registers.
984 994
985 // Check that the key is a smi. 995 // Check that the key is a smi.
986 __ JumpIfNotSmi(key, &slow); 996 __ JumpIfNotSmi(key, &slow);
987 // Check that the object isn't a smi. 997 // Check that the object isn't a smi.
988 __ JumpIfSmi(receiver, &slow); 998 __ JumpIfSmi(receiver, &slow);
989 // Get the map of the object. 999 // Get the map of the object.
990 __ lw(receiver_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); 1000 __ ld(receiver_map, FieldMemOperand(receiver, HeapObject::kMapOffset));
991 // Check that the receiver does not require access checks and is not observed. 1001 // Check that the receiver does not require access checks and is not observed.
992 // The generic stub does not perform map checks or handle observed objects. 1002 // The generic stub does not perform map checks or handle observed objects.
993 __ lbu(t0, FieldMemOperand(receiver_map, Map::kBitFieldOffset)); 1003 __ lbu(a4, FieldMemOperand(receiver_map, Map::kBitFieldOffset));
994 __ And(t0, t0, Operand(1 << Map::kIsAccessCheckNeeded | 1004 __ And(a4, a4, Operand(1 << Map::kIsAccessCheckNeeded |
995 1 << Map::kIsObserved)); 1005 1 << Map::kIsObserved));
996 __ Branch(&slow, ne, t0, Operand(zero_reg)); 1006 __ Branch(&slow, ne, a4, Operand(zero_reg));
997 // Check if the object is a JS array or not. 1007 // Check if the object is a JS array or not.
998 __ lbu(t0, FieldMemOperand(receiver_map, Map::kInstanceTypeOffset)); 1008 __ lbu(a4, FieldMemOperand(receiver_map, Map::kInstanceTypeOffset));
999 __ Branch(&array, eq, t0, Operand(JS_ARRAY_TYPE)); 1009 __ Branch(&array, eq, a4, Operand(JS_ARRAY_TYPE));
1000 // Check that the object is some kind of JSObject. 1010 // Check that the object is some kind of JSObject.
1001 __ Branch(&slow, lt, t0, Operand(FIRST_JS_OBJECT_TYPE)); 1011 __ Branch(&slow, lt, a4, Operand(FIRST_JS_OBJECT_TYPE));
1002 1012
1003 // Object case: Check key against length in the elements array. 1013 // Object case: Check key against length in the elements array.
1004 __ lw(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); 1014 __ ld(elements, FieldMemOperand(receiver, JSObject::kElementsOffset));
1005 // Check array bounds. Both the key and the length of FixedArray are smis. 1015 // Check array bounds. Both the key and the length of FixedArray are smis.
1006 __ lw(t0, FieldMemOperand(elements, FixedArray::kLengthOffset)); 1016 __ ld(a4, FieldMemOperand(elements, FixedArray::kLengthOffset));
1007 __ Branch(&fast_object, lo, key, Operand(t0)); 1017 __ Branch(&fast_object, lo, key, Operand(a4));
1008 1018
1009 // Slow case, handle jump to runtime. 1019 // Slow case, handle jump to runtime.
1010 __ bind(&slow); 1020 __ bind(&slow);
1011 // Entry registers are intact. 1021 // Entry registers are intact.
1012 // a0: value. 1022 // a0: value.
1013 // a1: key. 1023 // a1: key.
1014 // a2: receiver. 1024 // a2: receiver.
1015 GenerateRuntimeSetProperty(masm, strict_mode); 1025 GenerateRuntimeSetProperty(masm, strict_mode);
1016 1026
1017 // Extra capacity case: Check if there is extra capacity to 1027 // Extra capacity case: Check if there is extra capacity to
1018 // perform the store and update the length. Used for adding one 1028 // perform the store and update the length. Used for adding one
1019 // element to the array by writing to array[array.length]. 1029 // element to the array by writing to array[array.length].
1020 __ bind(&extra); 1030 __ bind(&extra);
1021 // Condition code from comparing key and array length is still available. 1031 // Condition code from comparing key and array length is still available.
1022 // Only support writing to array[array.length]. 1032 // Only support writing to array[array.length].
1023 __ Branch(&slow, ne, key, Operand(t0)); 1033 __ Branch(&slow, ne, key, Operand(a4));
1024 // Check for room in the elements backing store. 1034 // Check for room in the elements backing store.
1025 // Both the key and the length of FixedArray are smis. 1035 // Both the key and the length of FixedArray are smis.
1026 __ lw(t0, FieldMemOperand(elements, FixedArray::kLengthOffset)); 1036 __ ld(a4, FieldMemOperand(elements, FixedArray::kLengthOffset));
1027 __ Branch(&slow, hs, key, Operand(t0)); 1037 __ Branch(&slow, hs, key, Operand(a4));
1028 __ lw(elements_map, FieldMemOperand(elements, HeapObject::kMapOffset)); 1038 __ ld(elements_map, FieldMemOperand(elements, HeapObject::kMapOffset));
1029 __ Branch( 1039 __ Branch(
1030 &check_if_double_array, ne, elements_map, Heap::kFixedArrayMapRootIndex); 1040 &check_if_double_array, ne, elements_map, Heap::kFixedArrayMapRootIndex);
1031 1041
1032 __ jmp(&fast_object_grow); 1042 __ jmp(&fast_object_grow);
1033 1043
1034 __ bind(&check_if_double_array); 1044 __ bind(&check_if_double_array);
1035 __ Branch(&slow, ne, elements_map, Heap::kFixedDoubleArrayMapRootIndex); 1045 __ Branch(&slow, ne, elements_map, Heap::kFixedDoubleArrayMapRootIndex);
1036 __ jmp(&fast_double_grow); 1046 __ jmp(&fast_double_grow);
1037 1047
1038 // Array case: Get the length and the elements array from the JS 1048 // Array case: Get the length and the elements array from the JS
1039 // array. Check that the array is in fast mode (and writable); if it 1049 // array. Check that the array is in fast mode (and writable); if it
1040 // is the length is always a smi. 1050 // is the length is always a smi.
1041 __ bind(&array); 1051 __ bind(&array);
1042 __ lw(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); 1052 __ ld(elements, FieldMemOperand(receiver, JSObject::kElementsOffset));
1043 1053
1044 // Check the key against the length in the array. 1054 // Check the key against the length in the array.
1045 __ lw(t0, FieldMemOperand(receiver, JSArray::kLengthOffset)); 1055 __ ld(a4, FieldMemOperand(receiver, JSArray::kLengthOffset));
1046 __ Branch(&extra, hs, key, Operand(t0)); 1056 __ Branch(&extra, hs, key, Operand(a4));
1047 1057
1048 KeyedStoreGenerateGenericHelper(masm, &fast_object, &fast_double, 1058 KeyedStoreGenerateGenericHelper(masm, &fast_object, &fast_double,
1049 &slow, kCheckMap, kDontIncrementLength, 1059 &slow, kCheckMap, kDontIncrementLength,
1050 value, key, receiver, receiver_map, 1060 value, key, receiver, receiver_map,
1051 elements_map, elements); 1061 elements_map, elements);
1052 KeyedStoreGenerateGenericHelper(masm, &fast_object_grow, &fast_double_grow, 1062 KeyedStoreGenerateGenericHelper(masm, &fast_object_grow, &fast_double_grow,
1053 &slow, kDontCheckMap, kIncrementLength, 1063 &slow, kDontCheckMap, kIncrementLength,
1054 value, key, receiver, receiver_map, 1064 value, key, receiver, receiver_map,
1055 elements_map, elements); 1065 elements_map, elements);
1056 } 1066 }
1057 1067
1058 1068
1059 void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) { 1069 void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) {
1060 // Return address is in ra. 1070 // Return address is in ra.
1061 Label slow; 1071 Label slow;
1062 1072
1063 Register receiver = ReceiverRegister(); 1073 Register receiver = ReceiverRegister();
1064 Register key = NameRegister(); 1074 Register key = NameRegister();
1065 Register scratch1 = a3; 1075 Register scratch1 = a3;
1066 Register scratch2 = t0; 1076 Register scratch2 = a4;
1067 ASSERT(!scratch1.is(receiver) && !scratch1.is(key)); 1077 ASSERT(!scratch1.is(receiver) && !scratch1.is(key));
1068 ASSERT(!scratch2.is(receiver) && !scratch2.is(key)); 1078 ASSERT(!scratch2.is(receiver) && !scratch2.is(key));
1069 1079
1070 // Check that the receiver isn't a smi. 1080 // Check that the receiver isn't a smi.
1071 __ JumpIfSmi(receiver, &slow); 1081 __ JumpIfSmi(receiver, &slow);
1072 1082
1073 // Check that the key is an array index, that is Uint32. 1083 // Check that the key is an array index, that is Uint32.
1074 __ And(t0, key, Operand(kSmiTagMask | kSmiSignMask)); 1084 __ And(a4, key, Operand(kSmiTagMask | kSmiSignMask));
1075 __ Branch(&slow, ne, t0, Operand(zero_reg)); 1085 __ Branch(&slow, ne, a4, Operand(zero_reg));
1076 1086
1077 // Get the map of the receiver. 1087 // Get the map of the receiver.
1078 __ lw(scratch1, FieldMemOperand(receiver, HeapObject::kMapOffset)); 1088 __ ld(scratch1, FieldMemOperand(receiver, HeapObject::kMapOffset));
1079 1089
1080 // Check that it has indexed interceptor and access checks 1090 // Check that it has indexed interceptor and access checks
1081 // are not enabled for this object. 1091 // are not enabled for this object.
1082 __ lbu(scratch2, FieldMemOperand(scratch1, Map::kBitFieldOffset)); 1092 __ lbu(scratch2, FieldMemOperand(scratch1, Map::kBitFieldOffset));
1083 __ And(scratch2, scratch2, Operand(kSlowCaseBitFieldMask)); 1093 __ And(scratch2, scratch2, Operand(kSlowCaseBitFieldMask));
1084 __ Branch(&slow, ne, scratch2, Operand(1 << Map::kHasIndexedInterceptor)); 1094 __ Branch(&slow, ne, scratch2, Operand(1 << Map::kHasIndexedInterceptor));
1085 // Everything is fine, call runtime. 1095 // Everything is fine, call runtime.
1086 __ Push(receiver, key); // Receiver, key. 1096 __ Push(receiver, key); // Receiver, key.
1087 1097
1088 // Perform tail call to the entry. 1098 // Perform tail call to the entry.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 // ---------- S t a t e -------------- 1144 // ---------- S t a t e --------------
1135 // -- a0 : value 1145 // -- a0 : value
1136 // -- a1 : key 1146 // -- a1 : key
1137 // -- a2 : receiver 1147 // -- a2 : receiver
1138 // -- ra : return address 1148 // -- ra : return address
1139 // ----------------------------------- 1149 // -----------------------------------
1140 1150
1141 // Push receiver, key and value for runtime call. 1151 // Push receiver, key and value for runtime call.
1142 // We can't use MultiPush as the order of the registers is important. 1152 // We can't use MultiPush as the order of the registers is important.
1143 __ Push(a2, a1, a0); 1153 __ Push(a2, a1, a0);
1144
1145 // The slow case calls into the runtime to complete the store without causing 1154 // The slow case calls into the runtime to complete the store without causing
1146 // an IC miss that would otherwise cause a transition to the generic stub. 1155 // an IC miss that would otherwise cause a transition to the generic stub.
1147 ExternalReference ref = 1156 ExternalReference ref =
1148 ExternalReference(IC_Utility(kKeyedStoreIC_Slow), masm->isolate()); 1157 ExternalReference(IC_Utility(kKeyedStoreIC_Slow), masm->isolate());
1149 1158
1150 __ TailCallExternalReference(ref, 3, 1); 1159 __ TailCallExternalReference(ref, 3, 1);
1151 } 1160 }
1152 1161
1153 1162
1154 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { 1163 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) {
1155 // ----------- S t a t e ------------- 1164 // ----------- S t a t e -------------
1156 // -- a0 : value 1165 // -- a0 : value
1157 // -- a1 : receiver 1166 // -- a1 : receiver
1158 // -- a2 : name 1167 // -- a2 : name
1159 // -- ra : return address 1168 // -- ra : return address
1160 // ----------------------------------- 1169 // -----------------------------------
1161 1170
1162 // Get the receiver from the stack and probe the stub cache. 1171 // Get the receiver from the stack and probe the stub cache.
1163 Code::Flags flags = Code::ComputeHandlerFlags(Code::STORE_IC); 1172 Code::Flags flags = Code::ComputeHandlerFlags(Code::STORE_IC);
1164 masm->isolate()->stub_cache()->GenerateProbe( 1173 masm->isolate()->stub_cache()->GenerateProbe(
1165 masm, flags, a1, a2, a3, t0, t1, t2); 1174 masm, flags, a1, a2, a3, a4, a5, a6);
1166 1175
1167 // Cache miss: Jump to runtime. 1176 // Cache miss: Jump to runtime.
1168 GenerateMiss(masm); 1177 GenerateMiss(masm);
1169 } 1178 }
1170 1179
1171 1180
1172 void StoreIC::GenerateMiss(MacroAssembler* masm) { 1181 void StoreIC::GenerateMiss(MacroAssembler* masm) {
1173 // ----------- S t a t e ------------- 1182 // ----------- S t a t e -------------
1174 // -- a0 : value 1183 // -- a0 : value
1175 // -- a1 : receiver 1184 // -- a1 : receiver
(...skipping 11 matching lines...) Expand all
1187 1196
1188 void StoreIC::GenerateNormal(MacroAssembler* masm) { 1197 void StoreIC::GenerateNormal(MacroAssembler* masm) {
1189 // ----------- S t a t e ------------- 1198 // ----------- S t a t e -------------
1190 // -- a0 : value 1199 // -- a0 : value
1191 // -- a1 : receiver 1200 // -- a1 : receiver
1192 // -- a2 : name 1201 // -- a2 : name
1193 // -- ra : return address 1202 // -- ra : return address
1194 // ----------------------------------- 1203 // -----------------------------------
1195 Label miss; 1204 Label miss;
1196 1205
1197 GenerateNameDictionaryReceiverCheck(masm, a1, a3, t0, t1, &miss); 1206 GenerateNameDictionaryReceiverCheck(masm, a1, a3, a4, a5, &miss);
1198 1207
1199 GenerateDictionaryStore(masm, &miss, a3, a2, a0, t0, t1); 1208 GenerateDictionaryStore(masm, &miss, a3, a2, a0, a4, a5);
1200 Counters* counters = masm->isolate()->counters(); 1209 Counters* counters = masm->isolate()->counters();
1201 __ IncrementCounter(counters->store_normal_hit(), 1, t0, t1); 1210 __ IncrementCounter(counters->store_normal_hit(), 1, a4, a5);
1202 __ Ret(); 1211 __ Ret();
1203 1212
1204 __ bind(&miss); 1213 __ bind(&miss);
1205 __ IncrementCounter(counters->store_normal_miss(), 1, t0, t1); 1214 __ IncrementCounter(counters->store_normal_miss(), 1, a4, a5);
1206 GenerateMiss(masm); 1215 GenerateMiss(masm);
1207 } 1216 }
1208 1217
1209 1218
1210 void StoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm, 1219 void StoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
1211 StrictMode strict_mode) { 1220 StrictMode strict_mode) {
1212 // ----------- S t a t e ------------- 1221 // ----------- S t a t e -------------
1213 // -- a0 : value 1222 // -- a0 : value
1214 // -- a1 : receiver 1223 // -- a1 : receiver
1215 // -- a2 : name 1224 // -- a2 : name
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1318 patcher.ChangeBranchCondition(ne); 1327 patcher.ChangeBranchCondition(ne);
1319 } else { 1328 } else {
1320 ASSERT(Assembler::IsBne(branch_instr)); 1329 ASSERT(Assembler::IsBne(branch_instr));
1321 patcher.ChangeBranchCondition(eq); 1330 patcher.ChangeBranchCondition(eq);
1322 } 1331 }
1323 } 1332 }
1324 1333
1325 1334
1326 } } // namespace v8::internal 1335 } } // namespace v8::internal
1327 1336
1328 #endif // V8_TARGET_ARCH_MIPS 1337 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips64/full-codegen-mips64.cc ('k') | src/mips64/lithium-codegen-mips64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698