OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 } | 1094 } |
1095 | 1095 |
1096 | 1096 |
1097 void MacroAssembler::InvokeFunction(JSFunction* function, | 1097 void MacroAssembler::InvokeFunction(JSFunction* function, |
1098 const ParameterCount& actual, | 1098 const ParameterCount& actual, |
1099 InvokeFlag flag, | 1099 InvokeFlag flag, |
1100 CallKind call_kind) { | 1100 CallKind call_kind) { |
1101 // You can't call a function without a valid frame. | 1101 // You can't call a function without a valid frame. |
1102 ASSERT(flag == JUMP_FUNCTION || has_frame()); | 1102 ASSERT(flag == JUMP_FUNCTION || has_frame()); |
1103 | 1103 |
1104 ASSERT(function->is_compiled()); | |
1105 | |
1106 // Get the function and setup the context. | 1104 // Get the function and setup the context. |
1107 mov(r1, Operand(Handle<JSFunction>(function))); | 1105 mov(r1, Operand(Handle<JSFunction>(function))); |
1108 ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); | 1106 ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
1109 | 1107 |
1110 // Invoke the cached code. | |
1111 Handle<Code> code(function->code()); | |
1112 ParameterCount expected(function->shared()->formal_parameter_count()); | 1108 ParameterCount expected(function->shared()->formal_parameter_count()); |
1113 if (V8::UseCrankshaft()) { | 1109 // We call indirectly through the code field in the function to |
1114 // TODO(kasperl): For now, we always call indirectly through the | 1110 // allow recompilation to take effect without changing any of the |
1115 // code field in the function to allow recompilation to take effect | 1111 // call sites. |
1116 // without changing any of the call sites. | 1112 ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); |
1117 ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); | 1113 InvokeCode(r3, expected, actual, flag, NullCallWrapper(), call_kind); |
1118 InvokeCode(r3, expected, actual, flag, NullCallWrapper(), call_kind); | |
1119 } else { | |
1120 InvokeCode(code, expected, actual, RelocInfo::CODE_TARGET, flag, call_kind); | |
1121 } | |
1122 } | 1114 } |
1123 | 1115 |
1124 | 1116 |
1125 void MacroAssembler::IsObjectJSObjectType(Register heap_object, | 1117 void MacroAssembler::IsObjectJSObjectType(Register heap_object, |
1126 Register map, | 1118 Register map, |
1127 Register scratch, | 1119 Register scratch, |
1128 Label* fail) { | 1120 Label* fail) { |
1129 ldr(map, FieldMemOperand(heap_object, HeapObject::kMapOffset)); | 1121 ldr(map, FieldMemOperand(heap_object, HeapObject::kMapOffset)); |
1130 IsInstanceJSObjectType(map, scratch, fail); | 1122 IsInstanceJSObjectType(map, scratch, fail); |
1131 } | 1123 } |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1595 } | 1587 } |
1596 jmp(gc_required); | 1588 jmp(gc_required); |
1597 return; | 1589 return; |
1598 } | 1590 } |
1599 | 1591 |
1600 // Assert that the register arguments are different and that none of | 1592 // Assert that the register arguments are different and that none of |
1601 // them are ip. ip is used explicitly in the code generated below. | 1593 // them are ip. ip is used explicitly in the code generated below. |
1602 ASSERT(!result.is(scratch1)); | 1594 ASSERT(!result.is(scratch1)); |
1603 ASSERT(!result.is(scratch2)); | 1595 ASSERT(!result.is(scratch2)); |
1604 ASSERT(!scratch1.is(scratch2)); | 1596 ASSERT(!scratch1.is(scratch2)); |
| 1597 ASSERT(!object_size.is(ip)); |
1605 ASSERT(!result.is(ip)); | 1598 ASSERT(!result.is(ip)); |
1606 ASSERT(!scratch1.is(ip)); | 1599 ASSERT(!scratch1.is(ip)); |
1607 ASSERT(!scratch2.is(ip)); | 1600 ASSERT(!scratch2.is(ip)); |
1608 | 1601 |
1609 // Check relative positions of allocation top and limit addresses. | 1602 // Check relative positions of allocation top and limit addresses. |
1610 // The values must be adjacent in memory to allow the use of LDM. | 1603 // The values must be adjacent in memory to allow the use of LDM. |
1611 // Also, assert that the registers are numbered such that the values | 1604 // Also, assert that the registers are numbered such that the values |
1612 // are loaded in the correct order. | 1605 // are loaded in the correct order. |
1613 ExternalReference new_space_allocation_top = | 1606 ExternalReference new_space_allocation_top = |
1614 ExternalReference::new_space_allocation_top_address(isolate()); | 1607 ExternalReference::new_space_allocation_top_address(isolate()); |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2023 mov(ip, Operand(map)); | 2016 mov(ip, Operand(map)); |
2024 cmp(scratch, ip); | 2017 cmp(scratch, ip); |
2025 Jump(success, RelocInfo::CODE_TARGET, eq); | 2018 Jump(success, RelocInfo::CODE_TARGET, eq); |
2026 bind(&fail); | 2019 bind(&fail); |
2027 } | 2020 } |
2028 | 2021 |
2029 | 2022 |
2030 void MacroAssembler::TryGetFunctionPrototype(Register function, | 2023 void MacroAssembler::TryGetFunctionPrototype(Register function, |
2031 Register result, | 2024 Register result, |
2032 Register scratch, | 2025 Register scratch, |
2033 Label* miss) { | 2026 Label* miss, |
| 2027 bool miss_on_bound_function) { |
2034 // Check that the receiver isn't a smi. | 2028 // Check that the receiver isn't a smi. |
2035 JumpIfSmi(function, miss); | 2029 JumpIfSmi(function, miss); |
2036 | 2030 |
2037 // Check that the function really is a function. Load map into result reg. | 2031 // Check that the function really is a function. Load map into result reg. |
2038 CompareObjectType(function, result, scratch, JS_FUNCTION_TYPE); | 2032 CompareObjectType(function, result, scratch, JS_FUNCTION_TYPE); |
2039 b(ne, miss); | 2033 b(ne, miss); |
2040 | 2034 |
| 2035 if (miss_on_bound_function) { |
| 2036 ldr(scratch, |
| 2037 FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset)); |
| 2038 ldr(scratch, |
| 2039 FieldMemOperand(scratch, SharedFunctionInfo::kCompilerHintsOffset)); |
| 2040 tst(scratch, |
| 2041 Operand(Smi::FromInt(1 << SharedFunctionInfo::kBoundFunction))); |
| 2042 b(ne, miss); |
| 2043 } |
| 2044 |
2041 // Make sure that the function has an instance prototype. | 2045 // Make sure that the function has an instance prototype. |
2042 Label non_instance; | 2046 Label non_instance; |
2043 ldrb(scratch, FieldMemOperand(result, Map::kBitFieldOffset)); | 2047 ldrb(scratch, FieldMemOperand(result, Map::kBitFieldOffset)); |
2044 tst(scratch, Operand(1 << Map::kHasNonInstancePrototype)); | 2048 tst(scratch, Operand(1 << Map::kHasNonInstancePrototype)); |
2045 b(ne, &non_instance); | 2049 b(ne, &non_instance); |
2046 | 2050 |
2047 // Get the prototype or initial map from the function. | 2051 // Get the prototype or initial map from the function. |
2048 ldr(result, | 2052 ldr(result, |
2049 FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); | 2053 FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); |
2050 | 2054 |
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3140 Register source, // Input. | 3144 Register source, // Input. |
3141 Register scratch) { | 3145 Register scratch) { |
3142 ASSERT(!zeros.is(source) || !source.is(scratch)); | 3146 ASSERT(!zeros.is(source) || !source.is(scratch)); |
3143 ASSERT(!zeros.is(scratch)); | 3147 ASSERT(!zeros.is(scratch)); |
3144 ASSERT(!scratch.is(ip)); | 3148 ASSERT(!scratch.is(ip)); |
3145 ASSERT(!source.is(ip)); | 3149 ASSERT(!source.is(ip)); |
3146 ASSERT(!zeros.is(ip)); | 3150 ASSERT(!zeros.is(ip)); |
3147 #ifdef CAN_USE_ARMV5_INSTRUCTIONS | 3151 #ifdef CAN_USE_ARMV5_INSTRUCTIONS |
3148 clz(zeros, source); // This instruction is only supported after ARM5. | 3152 clz(zeros, source); // This instruction is only supported after ARM5. |
3149 #else | 3153 #else |
| 3154 // Order of the next two lines is important: zeros register |
| 3155 // can be the same as source register. |
| 3156 Move(scratch, source); |
3150 mov(zeros, Operand(0, RelocInfo::NONE)); | 3157 mov(zeros, Operand(0, RelocInfo::NONE)); |
3151 Move(scratch, source); | |
3152 // Top 16. | 3158 // Top 16. |
3153 tst(scratch, Operand(0xffff0000)); | 3159 tst(scratch, Operand(0xffff0000)); |
3154 add(zeros, zeros, Operand(16), LeaveCC, eq); | 3160 add(zeros, zeros, Operand(16), LeaveCC, eq); |
3155 mov(scratch, Operand(scratch, LSL, 16), LeaveCC, eq); | 3161 mov(scratch, Operand(scratch, LSL, 16), LeaveCC, eq); |
3156 // Top 8. | 3162 // Top 8. |
3157 tst(scratch, Operand(0xff000000)); | 3163 tst(scratch, Operand(0xff000000)); |
3158 add(zeros, zeros, Operand(8), LeaveCC, eq); | 3164 add(zeros, zeros, Operand(8), LeaveCC, eq); |
3159 mov(scratch, Operand(scratch, LSL, 8), LeaveCC, eq); | 3165 mov(scratch, Operand(scratch, LSL, 8), LeaveCC, eq); |
3160 // Top 4. | 3166 // Top 4. |
3161 tst(scratch, Operand(0xf0000000)); | 3167 tst(scratch, Operand(0xf0000000)); |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3651 void CodePatcher::EmitCondition(Condition cond) { | 3657 void CodePatcher::EmitCondition(Condition cond) { |
3652 Instr instr = Assembler::instr_at(masm_.pc_); | 3658 Instr instr = Assembler::instr_at(masm_.pc_); |
3653 instr = (instr & ~kCondMask) | cond; | 3659 instr = (instr & ~kCondMask) | cond; |
3654 masm_.emit(instr); | 3660 masm_.emit(instr); |
3655 } | 3661 } |
3656 | 3662 |
3657 | 3663 |
3658 } } // namespace v8::internal | 3664 } } // namespace v8::internal |
3659 | 3665 |
3660 #endif // V8_TARGET_ARCH_ARM | 3666 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |