| 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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
| 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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 // Try to allocate the object without transitioning into C code. If any of | 389 // Try to allocate the object without transitioning into C code. If any of |
| 390 // the preconditions is not met, the code bails out to the runtime call. | 390 // the preconditions is not met, the code bails out to the runtime call. |
| 391 Label rt_call, allocated; | 391 Label rt_call, allocated; |
| 392 if (FLAG_inline_new) { | 392 if (FLAG_inline_new) { |
| 393 ExternalReference debug_step_in_fp = | 393 ExternalReference debug_step_in_fp = |
| 394 ExternalReference::debug_step_in_fp_address(isolate); | 394 ExternalReference::debug_step_in_fp_address(isolate); |
| 395 __ li(a2, Operand(debug_step_in_fp)); | 395 __ li(a2, Operand(debug_step_in_fp)); |
| 396 __ lw(a2, MemOperand(a2)); | 396 __ lw(a2, MemOperand(a2)); |
| 397 __ Branch(&rt_call, ne, a2, Operand(zero_reg)); | 397 __ Branch(&rt_call, ne, a2, Operand(zero_reg)); |
| 398 | 398 |
| 399 // Fall back to runtime if the original constructor and function differ. | 399 // Verify that the original constructor is a JSFunction. |
| 400 __ Branch(&rt_call, ne, a1, Operand(a3)); | 400 __ GetObjectType(a3, t1, t0); |
| 401 __ Branch(&rt_call, ne, t0, Operand(JS_FUNCTION_TYPE)); |
| 401 | 402 |
| 402 // Load the initial map and verify that it is in fact a map. | 403 // Load the initial map and verify that it is in fact a map. |
| 403 // a1: constructor function | 404 // a3: original constructor |
| 404 __ lw(a2, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset)); | 405 __ lw(a2, FieldMemOperand(a3, JSFunction::kPrototypeOrInitialMapOffset)); |
| 405 __ JumpIfSmi(a2, &rt_call); | 406 __ JumpIfSmi(a2, &rt_call); |
| 406 __ GetObjectType(a2, t5, t4); | 407 __ GetObjectType(a2, t5, t4); |
| 407 __ Branch(&rt_call, ne, t4, Operand(MAP_TYPE)); | 408 __ Branch(&rt_call, ne, t4, Operand(MAP_TYPE)); |
| 408 | 409 |
| 410 // Fall back to runtime if the expected base constructor and base |
| 411 // constructor differ. |
| 412 __ lw(t1, FieldMemOperand(a2, Map::kConstructorOrBackPointerOffset)); |
| 413 __ Branch(&rt_call, ne, a1, Operand(t1)); |
| 414 |
| 409 // Check that the constructor is not constructing a JSFunction (see | 415 // Check that the constructor is not constructing a JSFunction (see |
| 410 // comments in Runtime_NewObject in runtime.cc). In which case the | 416 // comments in Runtime_NewObject in runtime.cc). In which case the |
| 411 // initial map's instance type would be JS_FUNCTION_TYPE. | 417 // initial map's instance type would be JS_FUNCTION_TYPE. |
| 412 // a1: constructor function | 418 // a1: constructor function |
| 413 // a2: initial map | 419 // a2: initial map |
| 414 __ lbu(t5, FieldMemOperand(a2, Map::kInstanceTypeOffset)); | 420 __ lbu(t5, FieldMemOperand(a2, Map::kInstanceTypeOffset)); |
| 415 __ Branch(&rt_call, eq, t5, Operand(JS_FUNCTION_TYPE)); | 421 __ Branch(&rt_call, eq, t5, Operand(JS_FUNCTION_TYPE)); |
| 416 | 422 |
| 417 if (!is_api_function) { | 423 if (!is_api_function) { |
| 418 Label allocate; | 424 Label allocate; |
| 419 MemOperand bit_field3 = FieldMemOperand(a2, Map::kBitField3Offset); | 425 MemOperand bit_field3 = FieldMemOperand(a2, Map::kBitField3Offset); |
| 420 // Check if slack tracking is enabled. | 426 // Check if slack tracking is enabled. |
| 421 __ lw(t0, bit_field3); | 427 __ lw(t0, bit_field3); |
| 422 __ DecodeField<Map::Counter>(t2, t0); | 428 __ DecodeField<Map::Counter>(t2, t0); |
| 423 __ Branch(&allocate, lt, t2, Operand(Map::kSlackTrackingCounterEnd)); | 429 __ Branch(&allocate, lt, t2, Operand(Map::kSlackTrackingCounterEnd)); |
| 424 // Decrease generous allocation count. | 430 // Decrease generous allocation count. |
| 425 __ Subu(t0, t0, Operand(1 << Map::Counter::kShift)); | 431 __ Subu(t0, t0, Operand(1 << Map::Counter::kShift)); |
| 426 __ Branch(USE_DELAY_SLOT, &allocate, ne, t2, | 432 __ Branch(USE_DELAY_SLOT, &allocate, ne, t2, |
| 427 Operand(Map::kSlackTrackingCounterEnd)); | 433 Operand(Map::kSlackTrackingCounterEnd)); |
| 428 __ sw(t0, bit_field3); // In delay slot. | 434 __ sw(t0, bit_field3); // In delay slot. |
| 429 | 435 |
| 430 __ Push(a1, a2, a1); // a1 = Constructor. | 436 __ Push(a1, a2, a2); // a2 = Initial map. |
| 431 __ CallRuntime(Runtime::kFinalizeInstanceSize, 1); | 437 __ CallRuntime(Runtime::kFinalizeInstanceSize, 1); |
| 432 | 438 |
| 433 __ Pop(a1, a2); | 439 __ Pop(a1, a2); |
| 434 __ li(t2, Operand(Map::kSlackTrackingCounterEnd - 1)); | 440 __ li(t2, Operand(Map::kSlackTrackingCounterEnd - 1)); |
| 435 | 441 |
| 436 __ bind(&allocate); | 442 __ bind(&allocate); |
| 437 } | 443 } |
| 438 | 444 |
| 439 // Now allocate the JSObject on the heap. | 445 // Now allocate the JSObject on the heap. |
| 440 // a1: constructor function | 446 // a1: constructor function |
| (...skipping 1521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1962 } | 1968 } |
| 1963 } | 1969 } |
| 1964 | 1970 |
| 1965 | 1971 |
| 1966 #undef __ | 1972 #undef __ |
| 1967 | 1973 |
| 1968 } // namespace internal | 1974 } // namespace internal |
| 1969 } // namespace v8 | 1975 } // namespace v8 |
| 1970 | 1976 |
| 1971 #endif // V8_TARGET_ARCH_MIPS | 1977 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |