OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 StubCache::GenerateProbe(masm, flags, r1, r2, r3); | 216 StubCache::GenerateProbe(masm, flags, r1, r2, r3); |
217 | 217 |
218 // If the stub cache probing failed, the receiver might be a value. | 218 // If the stub cache probing failed, the receiver might be a value. |
219 // For value objects, we use the map of the prototype objects for | 219 // For value objects, we use the map of the prototype objects for |
220 // the corresponding JSValue for the cache and that is what we need | 220 // the corresponding JSValue for the cache and that is what we need |
221 // to probe. | 221 // to probe. |
222 // | 222 // |
223 // Check for number. | 223 // Check for number. |
224 __ tst(r1, Operand(kSmiTagMask)); | 224 __ tst(r1, Operand(kSmiTagMask)); |
225 __ b(eq, &number); | 225 __ b(eq, &number); |
226 __ ldr(r3, FieldMemOperand(r1, HeapObject::kMapOffset)); | 226 __ CompareObjectType(r1, r3, r3, HEAP_NUMBER_TYPE); |
227 __ ldrb(r3, FieldMemOperand(r3, Map::kInstanceTypeOffset)); | |
228 __ cmp(r3, Operand(HEAP_NUMBER_TYPE)); | |
229 __ b(ne, &non_number); | 227 __ b(ne, &non_number); |
230 __ bind(&number); | 228 __ bind(&number); |
231 StubCompiler::GenerateLoadGlobalFunctionPrototype( | 229 StubCompiler::GenerateLoadGlobalFunctionPrototype( |
232 masm, Context::NUMBER_FUNCTION_INDEX, r1); | 230 masm, Context::NUMBER_FUNCTION_INDEX, r1); |
233 __ b(&probe); | 231 __ b(&probe); |
234 | 232 |
235 // Check for string. | 233 // Check for string. |
236 __ bind(&non_number); | 234 __ bind(&non_number); |
237 __ cmp(r3, Operand(FIRST_NONSTRING_TYPE)); | 235 __ cmp(r3, Operand(FIRST_NONSTRING_TYPE)); |
238 __ b(hs, &non_string); | 236 __ b(hs, &non_string); |
(...skipping 26 matching lines...) Expand all Loading... |
265 bool is_global_object, | 263 bool is_global_object, |
266 Label* miss) { | 264 Label* miss) { |
267 // Search dictionary - put result in register r1. | 265 // Search dictionary - put result in register r1. |
268 GenerateDictionaryLoad(masm, miss, r0, r1); | 266 GenerateDictionaryLoad(masm, miss, r0, r1); |
269 | 267 |
270 // Check that the value isn't a smi. | 268 // Check that the value isn't a smi. |
271 __ tst(r1, Operand(kSmiTagMask)); | 269 __ tst(r1, Operand(kSmiTagMask)); |
272 __ b(eq, miss); | 270 __ b(eq, miss); |
273 | 271 |
274 // Check that the value is a JSFunction. | 272 // Check that the value is a JSFunction. |
275 __ ldr(r0, FieldMemOperand(r1, HeapObject::kMapOffset)); | 273 __ CompareObjectType(r1, r0, r0, JS_FUNCTION_TYPE); |
276 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceTypeOffset)); | |
277 __ cmp(r0, Operand(JS_FUNCTION_TYPE)); | |
278 __ b(ne, miss); | 274 __ b(ne, miss); |
279 | 275 |
280 // Check that the function has been loaded. | 276 // Check that the function has been loaded. |
281 __ ldr(r0, FieldMemOperand(r1, JSObject::kMapOffset)); | 277 __ ldr(r0, FieldMemOperand(r1, JSObject::kMapOffset)); |
282 __ ldrb(r0, FieldMemOperand(r0, Map::kBitField2Offset)); | 278 __ ldrb(r0, FieldMemOperand(r0, Map::kBitField2Offset)); |
283 __ tst(r0, Operand(1 << Map::kNeedsLoading)); | 279 __ tst(r0, Operand(1 << Map::kNeedsLoading)); |
284 __ b(ne, miss); | 280 __ b(ne, miss); |
285 | 281 |
286 // Patch the receiver with the global proxy if necessary. | 282 // Patch the receiver with the global proxy if necessary. |
287 if (is_global_object) { | 283 if (is_global_object) { |
(...skipping 17 matching lines...) Expand all Loading... |
305 | 301 |
306 // Get the receiver of the function from the stack into r1. | 302 // Get the receiver of the function from the stack into r1. |
307 __ ldr(r1, MemOperand(sp, argc * kPointerSize)); | 303 __ ldr(r1, MemOperand(sp, argc * kPointerSize)); |
308 // Get the name of the function from the stack; 1 ~ receiver. | 304 // Get the name of the function from the stack; 1 ~ receiver. |
309 __ ldr(r2, MemOperand(sp, (argc + 1) * kPointerSize)); | 305 __ ldr(r2, MemOperand(sp, (argc + 1) * kPointerSize)); |
310 | 306 |
311 // Check that the receiver isn't a smi. | 307 // Check that the receiver isn't a smi. |
312 __ tst(r1, Operand(kSmiTagMask)); | 308 __ tst(r1, Operand(kSmiTagMask)); |
313 __ b(eq, &miss); | 309 __ b(eq, &miss); |
314 | 310 |
315 // Check that the receiver is a valid JS object. | 311 // Check that the receiver is a valid JS object. Put the map in r3. |
316 __ ldr(r3, FieldMemOperand(r1, HeapObject::kMapOffset)); | 312 __ CompareObjectType(r1, r3, r0, FIRST_JS_OBJECT_TYPE); |
317 __ ldrb(r0, FieldMemOperand(r3, Map::kInstanceTypeOffset)); | |
318 __ cmp(r0, Operand(FIRST_JS_OBJECT_TYPE)); | |
319 __ b(lt, &miss); | 313 __ b(lt, &miss); |
320 | 314 |
321 // If this assert fails, we have to check upper bound too. | 315 // If this assert fails, we have to check upper bound too. |
322 ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); | 316 ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); |
323 | 317 |
324 // Check for access to global object. | 318 // Check for access to global object. |
325 __ cmp(r0, Operand(JS_GLOBAL_OBJECT_TYPE)); | 319 __ cmp(r0, Operand(JS_GLOBAL_OBJECT_TYPE)); |
326 __ b(eq, &global_object); | 320 __ b(eq, &global_object); |
327 __ cmp(r0, Operand(JS_BUILTINS_OBJECT_TYPE)); | 321 __ cmp(r0, Operand(JS_BUILTINS_OBJECT_TYPE)); |
328 __ b(ne, &non_global_object); | 322 __ b(ne, &non_global_object); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 | 379 |
386 // Move result to r1 and leave the internal frame. | 380 // Move result to r1 and leave the internal frame. |
387 __ mov(r1, Operand(r0)); | 381 __ mov(r1, Operand(r0)); |
388 __ LeaveInternalFrame(); | 382 __ LeaveInternalFrame(); |
389 | 383 |
390 // Check if the receiver is a global object of some sort. | 384 // Check if the receiver is a global object of some sort. |
391 Label invoke, global; | 385 Label invoke, global; |
392 __ ldr(r2, MemOperand(sp, argc * kPointerSize)); // receiver | 386 __ ldr(r2, MemOperand(sp, argc * kPointerSize)); // receiver |
393 __ tst(r2, Operand(kSmiTagMask)); | 387 __ tst(r2, Operand(kSmiTagMask)); |
394 __ b(eq, &invoke); | 388 __ b(eq, &invoke); |
395 __ ldr(r3, FieldMemOperand(r2, HeapObject::kMapOffset)); | 389 __ CompareObjectType(r2, r3, r3, JS_GLOBAL_OBJECT_TYPE); |
396 __ ldrb(r3, FieldMemOperand(r3, Map::kInstanceTypeOffset)); | |
397 __ cmp(r3, Operand(JS_GLOBAL_OBJECT_TYPE)); | |
398 __ b(eq, &global); | 390 __ b(eq, &global); |
399 __ cmp(r3, Operand(JS_BUILTINS_OBJECT_TYPE)); | 391 __ cmp(r3, Operand(JS_BUILTINS_OBJECT_TYPE)); |
400 __ b(ne, &invoke); | 392 __ b(ne, &invoke); |
401 | 393 |
402 // Patch the receiver on the stack. | 394 // Patch the receiver on the stack. |
403 __ bind(&global); | 395 __ bind(&global); |
404 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalReceiverOffset)); | 396 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalReceiverOffset)); |
405 __ str(r2, MemOperand(sp, argc * kPointerSize)); | 397 __ str(r2, MemOperand(sp, argc * kPointerSize)); |
406 | 398 |
407 // Invoke the function. | 399 // Invoke the function. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 // -- [sp] : receiver | 432 // -- [sp] : receiver |
441 // ----------------------------------- | 433 // ----------------------------------- |
442 | 434 |
443 Label miss, probe, global; | 435 Label miss, probe, global; |
444 | 436 |
445 __ ldr(r0, MemOperand(sp, 0)); | 437 __ ldr(r0, MemOperand(sp, 0)); |
446 // Check that the receiver isn't a smi. | 438 // Check that the receiver isn't a smi. |
447 __ tst(r0, Operand(kSmiTagMask)); | 439 __ tst(r0, Operand(kSmiTagMask)); |
448 __ b(eq, &miss); | 440 __ b(eq, &miss); |
449 | 441 |
450 // Check that the receiver is a valid JS object. | 442 // Check that the receiver is a valid JS object. Put the map in r3. |
451 __ ldr(r3, FieldMemOperand(r0, HeapObject::kMapOffset)); | 443 __ CompareObjectType(r0, r3, r1, FIRST_JS_OBJECT_TYPE); |
452 __ ldrb(r1, FieldMemOperand(r3, Map::kInstanceTypeOffset)); | |
453 __ cmp(r1, Operand(FIRST_JS_OBJECT_TYPE)); | |
454 __ b(lt, &miss); | 444 __ b(lt, &miss); |
455 // If this assert fails, we have to check upper bound too. | 445 // If this assert fails, we have to check upper bound too. |
456 ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); | 446 ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); |
457 | 447 |
458 // Check for access to global object (unlikely). | 448 // Check for access to global object (unlikely). |
459 __ cmp(r1, Operand(JS_GLOBAL_PROXY_TYPE)); | 449 __ cmp(r1, Operand(JS_GLOBAL_PROXY_TYPE)); |
460 __ b(eq, &global); | 450 __ b(eq, &global); |
461 | 451 |
462 // Check for non-global object that requires access check. | 452 // Check for non-global object that requires access check. |
463 __ ldrb(r3, FieldMemOperand(r3, Map::kBitFieldOffset)); | 453 __ ldrb(r3, FieldMemOperand(r3, Map::kBitFieldOffset)); |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 | 788 |
799 // Perform tail call to the entry. | 789 // Perform tail call to the entry. |
800 __ TailCallRuntime(f, 3); | 790 __ TailCallRuntime(f, 3); |
801 } | 791 } |
802 | 792 |
803 | 793 |
804 #undef __ | 794 #undef __ |
805 | 795 |
806 | 796 |
807 } } // namespace v8::internal | 797 } } // namespace v8::internal |
OLD | NEW |