OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
6 | 6 |
7 #include "src/arm64/frames-arm64.h" | 7 #include "src/arm64/frames-arm64.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
383 // Try to allocate the object without transitioning into C code. If any of | 383 // Try to allocate the object without transitioning into C code. If any of |
384 // the preconditions is not met, the code bails out to the runtime call. | 384 // the preconditions is not met, the code bails out to the runtime call. |
385 Label rt_call, allocated; | 385 Label rt_call, allocated; |
386 if (FLAG_inline_new) { | 386 if (FLAG_inline_new) { |
387 ExternalReference debug_step_in_fp = | 387 ExternalReference debug_step_in_fp = |
388 ExternalReference::debug_step_in_fp_address(isolate); | 388 ExternalReference::debug_step_in_fp_address(isolate); |
389 __ Mov(x2, Operand(debug_step_in_fp)); | 389 __ Mov(x2, Operand(debug_step_in_fp)); |
390 __ Ldr(x2, MemOperand(x2)); | 390 __ Ldr(x2, MemOperand(x2)); |
391 __ Cbnz(x2, &rt_call); | 391 __ Cbnz(x2, &rt_call); |
392 | 392 |
393 // Fall back to runtime if the original constructor and function differ. | 393 // Verify that the original constructor is a JSFunction. |
394 __ Cmp(constructor, original_constructor); | 394 __ JumpIfNotObjectType(x3, x10, x11, JS_FUNCTION_TYPE, &rt_call); |
Igor Sheludko
2015/11/10 08:08:53
x3 -> original_constructor
Toon Verwaest
2015/11/10 08:13:04
Done.
| |
395 __ B(ne, &rt_call); | |
396 | 395 |
397 // Load the initial map and verify that it is in fact a map. | 396 // Load the initial map and verify that it is in fact a map. |
398 Register init_map = x2; | 397 Register init_map = x2; |
399 __ Ldr(init_map, | 398 __ Ldr(init_map, |
400 FieldMemOperand(constructor, | 399 FieldMemOperand(original_constructor, |
401 JSFunction::kPrototypeOrInitialMapOffset)); | 400 JSFunction::kPrototypeOrInitialMapOffset)); |
402 __ JumpIfSmi(init_map, &rt_call); | 401 __ JumpIfSmi(init_map, &rt_call); |
403 __ JumpIfNotObjectType(init_map, x10, x11, MAP_TYPE, &rt_call); | 402 __ JumpIfNotObjectType(init_map, x10, x11, MAP_TYPE, &rt_call); |
404 | 403 |
404 // Fall back to runtime if the expected base constructor and base | |
405 // constructor differ. | |
406 __ Ldr(x10, | |
407 FieldMemOperand(init_map, Map::kConstructorOrBackPointerOffset)); | |
408 __ Cmp(constructor, x10); | |
409 __ B(ne, &rt_call); | |
410 | |
405 // Check that the constructor is not constructing a JSFunction (see | 411 // Check that the constructor is not constructing a JSFunction (see |
406 // comments in Runtime_NewObject in runtime.cc). In which case the initial | 412 // comments in Runtime_NewObject in runtime.cc). In which case the initial |
407 // map's instance type would be JS_FUNCTION_TYPE. | 413 // map's instance type would be JS_FUNCTION_TYPE. |
408 __ CompareInstanceType(init_map, x10, JS_FUNCTION_TYPE); | 414 __ CompareInstanceType(init_map, x10, JS_FUNCTION_TYPE); |
409 __ B(eq, &rt_call); | 415 __ B(eq, &rt_call); |
410 | 416 |
411 Register constructon_count = x14; | 417 Register constructon_count = x14; |
412 if (!is_api_function) { | 418 if (!is_api_function) { |
413 Label allocate; | 419 Label allocate; |
414 MemOperand bit_field3 = | 420 MemOperand bit_field3 = |
415 FieldMemOperand(init_map, Map::kBitField3Offset); | 421 FieldMemOperand(init_map, Map::kBitField3Offset); |
416 // Check if slack tracking is enabled. | 422 // Check if slack tracking is enabled. |
417 __ Ldr(x4, bit_field3); | 423 __ Ldr(x4, bit_field3); |
418 __ DecodeField<Map::Counter>(constructon_count, x4); | 424 __ DecodeField<Map::Counter>(constructon_count, x4); |
419 __ Cmp(constructon_count, Operand(Map::kSlackTrackingCounterEnd)); | 425 __ Cmp(constructon_count, Operand(Map::kSlackTrackingCounterEnd)); |
420 __ B(lt, &allocate); | 426 __ B(lt, &allocate); |
421 // Decrease generous allocation count. | 427 // Decrease generous allocation count. |
422 __ Subs(x4, x4, Operand(1 << Map::Counter::kShift)); | 428 __ Subs(x4, x4, Operand(1 << Map::Counter::kShift)); |
423 __ Str(x4, bit_field3); | 429 __ Str(x4, bit_field3); |
424 __ Cmp(constructon_count, Operand(Map::kSlackTrackingCounterEnd)); | 430 __ Cmp(constructon_count, Operand(Map::kSlackTrackingCounterEnd)); |
425 __ B(ne, &allocate); | 431 __ B(ne, &allocate); |
426 | 432 |
427 // Push the constructor and map to the stack, and the constructor again | 433 // Push the constructor and map to the stack, and the map again |
428 // as argument to the runtime call. | 434 // as argument to the runtime call. |
429 __ Push(constructor, init_map, constructor); | 435 __ Push(constructor, init_map, init_map); |
430 __ CallRuntime(Runtime::kFinalizeInstanceSize, 1); | 436 __ CallRuntime(Runtime::kFinalizeInstanceSize, 1); |
431 __ Pop(init_map, constructor); | 437 __ Pop(init_map, constructor); |
432 __ Mov(constructon_count, Operand(Map::kSlackTrackingCounterEnd - 1)); | 438 __ Mov(constructon_count, Operand(Map::kSlackTrackingCounterEnd - 1)); |
433 __ Bind(&allocate); | 439 __ Bind(&allocate); |
434 } | 440 } |
435 | 441 |
436 // Now allocate the JSObject on the heap. | 442 // Now allocate the JSObject on the heap. |
437 Label rt_call_reload_new_target; | 443 Label rt_call_reload_new_target; |
438 Register obj_size = x3; | 444 Register obj_size = x3; |
439 Register new_obj = x4; | 445 Register new_obj = x4; |
(...skipping 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2025 } | 2031 } |
2026 } | 2032 } |
2027 | 2033 |
2028 | 2034 |
2029 #undef __ | 2035 #undef __ |
2030 | 2036 |
2031 } // namespace internal | 2037 } // namespace internal |
2032 } // namespace v8 | 2038 } // namespace v8 |
2033 | 2039 |
2034 #endif // V8_TARGET_ARCH_ARM | 2040 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |