| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 26 matching lines...) Expand all Loading... |
| 37 #include "debug.h" | 37 #include "debug.h" |
| 38 #include "isolate-inl.h" | 38 #include "isolate-inl.h" |
| 39 #include "runtime.h" | 39 #include "runtime.h" |
| 40 | 40 |
| 41 namespace v8 { | 41 namespace v8 { |
| 42 namespace internal { | 42 namespace internal { |
| 43 | 43 |
| 44 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size) | 44 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size) |
| 45 : Assembler(arg_isolate, buffer, size), | 45 : Assembler(arg_isolate, buffer, size), |
| 46 generating_stub_(false), | 46 generating_stub_(false), |
| 47 allow_stub_calls_(true), | |
| 48 has_frame_(false) { | 47 has_frame_(false) { |
| 49 if (isolate() != NULL) { | 48 if (isolate() != NULL) { |
| 50 code_object_ = Handle<Object>(isolate()->heap()->undefined_value(), | 49 code_object_ = Handle<Object>(isolate()->heap()->undefined_value(), |
| 51 isolate()); | 50 isolate()); |
| 52 } | 51 } |
| 53 } | 52 } |
| 54 | 53 |
| 55 | 54 |
| 56 void MacroAssembler::Jump(Register target, Condition cond) { | 55 void MacroAssembler::Jump(Register target, Condition cond) { |
| 57 bx(target, cond); | 56 bx(target, cond); |
| (...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1222 SharedFunctionInfo::kFormalParameterCountOffset)); | 1221 SharedFunctionInfo::kFormalParameterCountOffset)); |
| 1223 SmiUntag(expected_reg); | 1222 SmiUntag(expected_reg); |
| 1224 ldr(code_reg, | 1223 ldr(code_reg, |
| 1225 FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); | 1224 FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); |
| 1226 | 1225 |
| 1227 ParameterCount expected(expected_reg); | 1226 ParameterCount expected(expected_reg); |
| 1228 InvokeCode(code_reg, expected, actual, flag, call_wrapper, call_kind); | 1227 InvokeCode(code_reg, expected, actual, flag, call_wrapper, call_kind); |
| 1229 } | 1228 } |
| 1230 | 1229 |
| 1231 | 1230 |
| 1232 void MacroAssembler::InvokeFunction(Handle<JSFunction> function, | 1231 void MacroAssembler::InvokeFunction(Register function, |
| 1233 const ParameterCount& expected, | 1232 const ParameterCount& expected, |
| 1234 const ParameterCount& actual, | 1233 const ParameterCount& actual, |
| 1235 InvokeFlag flag, | 1234 InvokeFlag flag, |
| 1236 const CallWrapper& call_wrapper, | 1235 const CallWrapper& call_wrapper, |
| 1237 CallKind call_kind) { | 1236 CallKind call_kind) { |
| 1238 // You can't call a function without a valid frame. | 1237 // You can't call a function without a valid frame. |
| 1239 ASSERT(flag == JUMP_FUNCTION || has_frame()); | 1238 ASSERT(flag == JUMP_FUNCTION || has_frame()); |
| 1240 | 1239 |
| 1240 // Contract with called JS functions requires that function is passed in r1. |
| 1241 ASSERT(function.is(r1)); |
| 1242 |
| 1241 // Get the function and setup the context. | 1243 // Get the function and setup the context. |
| 1242 Move(r1, function); | |
| 1243 ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); | 1244 ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
| 1244 | 1245 |
| 1245 // We call indirectly through the code field in the function to | 1246 // We call indirectly through the code field in the function to |
| 1246 // allow recompilation to take effect without changing any of the | 1247 // allow recompilation to take effect without changing any of the |
| 1247 // call sites. | 1248 // call sites. |
| 1248 ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); | 1249 ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); |
| 1249 InvokeCode(r3, expected, actual, flag, call_wrapper, call_kind); | 1250 InvokeCode(r3, expected, actual, flag, call_wrapper, call_kind); |
| 1250 } | 1251 } |
| 1251 | 1252 |
| 1252 | 1253 |
| 1254 void MacroAssembler::InvokeFunction(Handle<JSFunction> function, |
| 1255 const ParameterCount& expected, |
| 1256 const ParameterCount& actual, |
| 1257 InvokeFlag flag, |
| 1258 const CallWrapper& call_wrapper, |
| 1259 CallKind call_kind) { |
| 1260 Move(r1, function); |
| 1261 InvokeFunction(r1, expected, actual, flag, call_wrapper, call_kind); |
| 1262 } |
| 1263 |
| 1264 |
| 1253 void MacroAssembler::IsObjectJSObjectType(Register heap_object, | 1265 void MacroAssembler::IsObjectJSObjectType(Register heap_object, |
| 1254 Register map, | 1266 Register map, |
| 1255 Register scratch, | 1267 Register scratch, |
| 1256 Label* fail) { | 1268 Label* fail) { |
| 1257 ldr(map, FieldMemOperand(heap_object, HeapObject::kMapOffset)); | 1269 ldr(map, FieldMemOperand(heap_object, HeapObject::kMapOffset)); |
| 1258 IsInstanceJSObjectType(map, scratch, fail); | 1270 IsInstanceJSObjectType(map, scratch, fail); |
| 1259 } | 1271 } |
| 1260 | 1272 |
| 1261 | 1273 |
| 1262 void MacroAssembler::IsInstanceJSObjectType(Register map, | 1274 void MacroAssembler::IsInstanceJSObjectType(Register map, |
| (...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2269 | 2281 |
| 2270 void MacroAssembler::CallStub(CodeStub* stub, | 2282 void MacroAssembler::CallStub(CodeStub* stub, |
| 2271 TypeFeedbackId ast_id, | 2283 TypeFeedbackId ast_id, |
| 2272 Condition cond) { | 2284 Condition cond) { |
| 2273 ASSERT(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs. | 2285 ASSERT(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs. |
| 2274 Call(stub->GetCode(isolate()), RelocInfo::CODE_TARGET, ast_id, cond); | 2286 Call(stub->GetCode(isolate()), RelocInfo::CODE_TARGET, ast_id, cond); |
| 2275 } | 2287 } |
| 2276 | 2288 |
| 2277 | 2289 |
| 2278 void MacroAssembler::TailCallStub(CodeStub* stub, Condition cond) { | 2290 void MacroAssembler::TailCallStub(CodeStub* stub, Condition cond) { |
| 2279 ASSERT(allow_stub_calls_ || | |
| 2280 stub->CompilingCallsToThisStubIsGCSafe(isolate())); | |
| 2281 Jump(stub->GetCode(isolate()), RelocInfo::CODE_TARGET, cond); | 2291 Jump(stub->GetCode(isolate()), RelocInfo::CODE_TARGET, cond); |
| 2282 } | 2292 } |
| 2283 | 2293 |
| 2284 | 2294 |
| 2285 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { | 2295 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { |
| 2286 return ref0.address() - ref1.address(); | 2296 return ref0.address() - ref1.address(); |
| 2287 } | 2297 } |
| 2288 | 2298 |
| 2289 | 2299 |
| 2290 void MacroAssembler::CallApiFunctionAndReturn( | 2300 void MacroAssembler::CallApiFunctionAndReturn( |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2415 PrepareCallCFunction(1, r5); | 2425 PrepareCallCFunction(1, r5); |
| 2416 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); | 2426 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); |
| 2417 CallCFunction( | 2427 CallCFunction( |
| 2418 ExternalReference::delete_handle_scope_extensions(isolate()), 1); | 2428 ExternalReference::delete_handle_scope_extensions(isolate()), 1); |
| 2419 mov(r0, r4); | 2429 mov(r0, r4); |
| 2420 jmp(&leave_exit_frame); | 2430 jmp(&leave_exit_frame); |
| 2421 } | 2431 } |
| 2422 | 2432 |
| 2423 | 2433 |
| 2424 bool MacroAssembler::AllowThisStubCall(CodeStub* stub) { | 2434 bool MacroAssembler::AllowThisStubCall(CodeStub* stub) { |
| 2425 if (!has_frame_ && stub->SometimesSetsUpAFrame()) return false; | 2435 return has_frame_ || !stub->SometimesSetsUpAFrame(); |
| 2426 return allow_stub_calls_ || stub->CompilingCallsToThisStubIsGCSafe(isolate()); | |
| 2427 } | 2436 } |
| 2428 | 2437 |
| 2429 | 2438 |
| 2430 void MacroAssembler::IllegalOperation(int num_arguments) { | 2439 void MacroAssembler::IllegalOperation(int num_arguments) { |
| 2431 if (num_arguments > 0) { | 2440 if (num_arguments > 0) { |
| 2432 add(sp, sp, Operand(num_arguments * kPointerSize)); | 2441 add(sp, sp, Operand(num_arguments * kPointerSize)); |
| 2433 } | 2442 } |
| 2434 LoadRoot(r0, Heap::kUndefinedValueRootIndex); | 2443 LoadRoot(r0, Heap::kUndefinedValueRootIndex); |
| 2435 } | 2444 } |
| 2436 | 2445 |
| (...skipping 1633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4070 void CodePatcher::EmitCondition(Condition cond) { | 4079 void CodePatcher::EmitCondition(Condition cond) { |
| 4071 Instr instr = Assembler::instr_at(masm_.pc_); | 4080 Instr instr = Assembler::instr_at(masm_.pc_); |
| 4072 instr = (instr & ~kCondMask) | cond; | 4081 instr = (instr & ~kCondMask) | cond; |
| 4073 masm_.emit(instr); | 4082 masm_.emit(instr); |
| 4074 } | 4083 } |
| 4075 | 4084 |
| 4076 | 4085 |
| 4077 } } // namespace v8::internal | 4086 } } // namespace v8::internal |
| 4078 | 4087 |
| 4079 #endif // V8_TARGET_ARCH_ARM | 4088 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |