OLD | NEW |
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 #if V8_TARGET_ARCH_ARM | 5 #if V8_TARGET_ARCH_ARM |
6 | 6 |
7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 // the preconditions is not met, the code bails out to the runtime call. | 381 // the preconditions is not met, the code bails out to the runtime call. |
382 Label rt_call, allocated; | 382 Label rt_call, allocated; |
383 if (FLAG_inline_new) { | 383 if (FLAG_inline_new) { |
384 ExternalReference debug_step_in_fp = | 384 ExternalReference debug_step_in_fp = |
385 ExternalReference::debug_step_in_fp_address(isolate); | 385 ExternalReference::debug_step_in_fp_address(isolate); |
386 __ mov(r2, Operand(debug_step_in_fp)); | 386 __ mov(r2, Operand(debug_step_in_fp)); |
387 __ ldr(r2, MemOperand(r2)); | 387 __ ldr(r2, MemOperand(r2)); |
388 __ tst(r2, r2); | 388 __ tst(r2, r2); |
389 __ b(ne, &rt_call); | 389 __ b(ne, &rt_call); |
390 | 390 |
391 // Fall back to runtime if the original constructor and function differ. | 391 // Verify that the original constructor is a JSFunction. |
392 __ cmp(r1, r3); | 392 __ CompareObjectType(r3, r5, r4, JS_FUNCTION_TYPE); |
393 __ b(ne, &rt_call); | 393 __ b(ne, &rt_call); |
394 | 394 |
395 // Load the initial map and verify that it is in fact a map. | 395 // Load the initial map and verify that it is in fact a map. |
396 // r1: constructor function | 396 // r3: original constructor |
397 __ ldr(r2, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset)); | 397 __ ldr(r2, FieldMemOperand(r3, JSFunction::kPrototypeOrInitialMapOffset)); |
398 __ JumpIfSmi(r2, &rt_call); | 398 __ JumpIfSmi(r2, &rt_call); |
399 __ CompareObjectType(r2, r5, r4, MAP_TYPE); | 399 __ CompareObjectType(r2, r5, r4, MAP_TYPE); |
400 __ b(ne, &rt_call); | 400 __ b(ne, &rt_call); |
401 | 401 |
| 402 // Fall back to runtime if the expected base constructor and base |
| 403 // constructor differ. |
| 404 __ ldr(r5, FieldMemOperand(r2, Map::kConstructorOrBackPointerOffset)); |
| 405 __ cmp(r1, r5); |
| 406 __ b(ne, &rt_call); |
| 407 |
402 // Check that the constructor is not constructing a JSFunction (see | 408 // Check that the constructor is not constructing a JSFunction (see |
403 // comments in Runtime_NewObject in runtime.cc). In which case the | 409 // comments in Runtime_NewObject in runtime.cc). In which case the |
404 // initial map's instance type would be JS_FUNCTION_TYPE. | 410 // initial map's instance type would be JS_FUNCTION_TYPE. |
405 // r1: constructor function | 411 // r1: constructor function |
406 // r2: initial map | 412 // r2: initial map |
407 __ CompareInstanceType(r2, r5, JS_FUNCTION_TYPE); | 413 __ CompareInstanceType(r2, r5, JS_FUNCTION_TYPE); |
408 __ b(eq, &rt_call); | 414 __ b(eq, &rt_call); |
409 | 415 |
410 if (!is_api_function) { | 416 if (!is_api_function) { |
411 Label allocate; | 417 Label allocate; |
412 MemOperand bit_field3 = FieldMemOperand(r2, Map::kBitField3Offset); | 418 MemOperand bit_field3 = FieldMemOperand(r2, Map::kBitField3Offset); |
413 // Check if slack tracking is enabled. | 419 // Check if slack tracking is enabled. |
414 __ ldr(r4, bit_field3); | 420 __ ldr(r4, bit_field3); |
415 __ DecodeField<Map::Counter>(r3, r4); | 421 __ DecodeField<Map::Counter>(r3, r4); |
416 __ cmp(r3, Operand(Map::kSlackTrackingCounterEnd)); | 422 __ cmp(r3, Operand(Map::kSlackTrackingCounterEnd)); |
417 __ b(lt, &allocate); | 423 __ b(lt, &allocate); |
418 // Decrease generous allocation count. | 424 // Decrease generous allocation count. |
419 __ sub(r4, r4, Operand(1 << Map::Counter::kShift)); | 425 __ sub(r4, r4, Operand(1 << Map::Counter::kShift)); |
420 __ str(r4, bit_field3); | 426 __ str(r4, bit_field3); |
421 __ cmp(r3, Operand(Map::kSlackTrackingCounterEnd)); | 427 __ cmp(r3, Operand(Map::kSlackTrackingCounterEnd)); |
422 __ b(ne, &allocate); | 428 __ b(ne, &allocate); |
423 | 429 |
424 __ push(r1); | 430 __ Push(r1, r2); |
425 | 431 |
426 __ Push(r2, r1); // r1 = constructor | 432 __ push(r2); // r2 = intial map |
427 __ CallRuntime(Runtime::kFinalizeInstanceSize, 1); | 433 __ CallRuntime(Runtime::kFinalizeInstanceSize, 1); |
428 | 434 |
429 __ pop(r2); | 435 __ pop(r2); |
430 __ pop(r1); | 436 __ pop(r1); |
431 | 437 |
432 __ bind(&allocate); | 438 __ bind(&allocate); |
433 } | 439 } |
434 | 440 |
435 // Now allocate the JSObject on the heap. | 441 // Now allocate the JSObject on the heap. |
436 // r1: constructor function | 442 // r1: constructor function |
(...skipping 1499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1936 } | 1942 } |
1937 } | 1943 } |
1938 | 1944 |
1939 | 1945 |
1940 #undef __ | 1946 #undef __ |
1941 | 1947 |
1942 } // namespace internal | 1948 } // namespace internal |
1943 } // namespace v8 | 1949 } // namespace v8 |
1944 | 1950 |
1945 #endif // V8_TARGET_ARCH_ARM | 1951 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |