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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/arm64/lithium-codegen-arm64.h" | 7 #include "src/arm64/lithium-codegen-arm64.h" |
8 #include "src/arm64/lithium-gap-resolver-arm64.h" | 8 #include "src/arm64/lithium-gap-resolver-arm64.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/hydrogen-osr.h" | 10 #include "src/hydrogen-osr.h" |
(...skipping 3314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3325 } | 3325 } |
3326 } | 3326 } |
3327 } | 3327 } |
3328 | 3328 |
3329 | 3329 |
3330 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { | 3330 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { |
3331 Register function = ToRegister(instr->function()); | 3331 Register function = ToRegister(instr->function()); |
3332 Register result = ToRegister(instr->result()); | 3332 Register result = ToRegister(instr->result()); |
3333 Register temp = ToRegister(instr->temp()); | 3333 Register temp = ToRegister(instr->temp()); |
3334 | 3334 |
3335 // Check that the function really is a function. Leaves map in the result | |
3336 // register. | |
3337 __ CompareObjectType(function, result, temp, JS_FUNCTION_TYPE); | |
3338 DeoptimizeIf(ne, instr->environment()); | |
3339 | |
3340 // Make sure that the function has an instance prototype. | |
3341 Label non_instance; | |
3342 __ Ldrb(temp, FieldMemOperand(result, Map::kBitFieldOffset)); | |
3343 __ Tbnz(temp, Map::kHasNonInstancePrototype, &non_instance); | |
3344 | |
3345 // Get the prototype or initial map from the function. | 3335 // Get the prototype or initial map from the function. |
3346 __ Ldr(result, FieldMemOperand(function, | 3336 __ Ldr(result, FieldMemOperand(function, |
3347 JSFunction::kPrototypeOrInitialMapOffset)); | 3337 JSFunction::kPrototypeOrInitialMapOffset)); |
3348 | 3338 |
3349 // Check that the function has a prototype or an initial map. | 3339 // Check that the function has a prototype or an initial map. |
3350 DeoptimizeIfRoot(result, Heap::kTheHoleValueRootIndex, | 3340 DeoptimizeIfRoot(result, Heap::kTheHoleValueRootIndex, |
3351 instr->environment()); | 3341 instr->environment()); |
3352 | 3342 |
3353 // If the function does not have an initial map, we're done. | 3343 // If the function does not have an initial map, we're done. |
3354 Label done; | 3344 Label done; |
3355 __ CompareObjectType(result, temp, temp, MAP_TYPE); | 3345 __ CompareObjectType(result, temp, temp, MAP_TYPE); |
3356 __ B(ne, &done); | 3346 __ B(ne, &done); |
3357 | 3347 |
3358 // Get the prototype from the initial map. | 3348 // Get the prototype from the initial map. |
3359 __ Ldr(result, FieldMemOperand(result, Map::kPrototypeOffset)); | 3349 __ Ldr(result, FieldMemOperand(result, Map::kPrototypeOffset)); |
3360 __ B(&done); | |
3361 | |
3362 // Non-instance prototype: fetch prototype from constructor field in initial | |
3363 // map. | |
3364 __ Bind(&non_instance); | |
3365 __ Ldr(result, FieldMemOperand(result, Map::kConstructorOffset)); | |
3366 | 3350 |
3367 // All done. | 3351 // All done. |
3368 __ Bind(&done); | 3352 __ Bind(&done); |
3369 } | 3353 } |
3370 | 3354 |
3371 | 3355 |
3372 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) { | 3356 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) { |
3373 Register result = ToRegister(instr->result()); | 3357 Register result = ToRegister(instr->result()); |
3374 __ Mov(result, Operand(Handle<Object>(instr->hydrogen()->cell().handle()))); | 3358 __ Mov(result, Operand(Handle<Object>(instr->hydrogen()->cell().handle()))); |
3375 __ Ldr(result, FieldMemOperand(result, Cell::kValueOffset)); | 3359 __ Ldr(result, FieldMemOperand(result, Cell::kValueOffset)); |
(...skipping 2678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6054 Handle<ScopeInfo> scope_info = instr->scope_info(); | 6038 Handle<ScopeInfo> scope_info = instr->scope_info(); |
6055 __ Push(scope_info); | 6039 __ Push(scope_info); |
6056 __ Push(ToRegister(instr->function())); | 6040 __ Push(ToRegister(instr->function())); |
6057 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6041 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6058 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6042 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6059 } | 6043 } |
6060 | 6044 |
6061 | 6045 |
6062 | 6046 |
6063 } } // namespace v8::internal | 6047 } } // namespace v8::internal |
OLD | NEW |