| 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 } | 226 } |
| 227 | 227 |
| 228 | 228 |
| 229 void MacroAssembler::Push(Handle<Object> handle) { | 229 void MacroAssembler::Push(Handle<Object> handle) { |
| 230 mov(ip, Operand(handle)); | 230 mov(ip, Operand(handle)); |
| 231 push(ip); | 231 push(ip); |
| 232 } | 232 } |
| 233 | 233 |
| 234 | 234 |
| 235 void MacroAssembler::Move(Register dst, Handle<Object> value) { | 235 void MacroAssembler::Move(Register dst, Handle<Object> value) { |
| 236 mov(dst, Operand(value)); | 236 AllowDeferredHandleDereference smi_check; |
| 237 if (value->IsSmi()) { |
| 238 mov(dst, Operand(value)); |
| 239 } else { |
| 240 ASSERT(value->IsHeapObject()); |
| 241 if (isolate()->heap()->InNewSpace(*value)) { |
| 242 Handle<Cell> cell = isolate()->factory()->NewCell(value); |
| 243 mov(dst, Operand(cell)); |
| 244 ldr(dst, FieldMemOperand(dst, Cell::kValueOffset)); |
| 245 } else { |
| 246 mov(dst, Operand(value)); |
| 247 } |
| 248 } |
| 237 } | 249 } |
| 238 | 250 |
| 239 | 251 |
| 240 void MacroAssembler::Move(Register dst, Register src, Condition cond) { | 252 void MacroAssembler::Move(Register dst, Register src, Condition cond) { |
| 241 if (!dst.is(src)) { | 253 if (!dst.is(src)) { |
| 242 mov(dst, src, LeaveCC, cond); | 254 mov(dst, src, LeaveCC, cond); |
| 243 } | 255 } |
| 244 } | 256 } |
| 245 | 257 |
| 246 | 258 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 } | 399 } |
| 388 | 400 |
| 389 | 401 |
| 390 void MacroAssembler::StoreRoot(Register source, | 402 void MacroAssembler::StoreRoot(Register source, |
| 391 Heap::RootListIndex index, | 403 Heap::RootListIndex index, |
| 392 Condition cond) { | 404 Condition cond) { |
| 393 str(source, MemOperand(kRootRegister, index << kPointerSizeLog2), cond); | 405 str(source, MemOperand(kRootRegister, index << kPointerSizeLog2), cond); |
| 394 } | 406 } |
| 395 | 407 |
| 396 | 408 |
| 397 void MacroAssembler::LoadHeapObject(Register result, | |
| 398 Handle<HeapObject> object) { | |
| 399 AllowDeferredHandleDereference using_raw_address; | |
| 400 if (isolate()->heap()->InNewSpace(*object)) { | |
| 401 Handle<Cell> cell = isolate()->factory()->NewCell(object); | |
| 402 mov(result, Operand(cell)); | |
| 403 ldr(result, FieldMemOperand(result, Cell::kValueOffset)); | |
| 404 } else { | |
| 405 mov(result, Operand(object)); | |
| 406 } | |
| 407 } | |
| 408 | |
| 409 | |
| 410 void MacroAssembler::InNewSpace(Register object, | 409 void MacroAssembler::InNewSpace(Register object, |
| 411 Register scratch, | 410 Register scratch, |
| 412 Condition cond, | 411 Condition cond, |
| 413 Label* branch) { | 412 Label* branch) { |
| 414 ASSERT(cond == eq || cond == ne); | 413 ASSERT(cond == eq || cond == ne); |
| 415 and_(scratch, object, Operand(ExternalReference::new_space_mask(isolate()))); | 414 and_(scratch, object, Operand(ExternalReference::new_space_mask(isolate()))); |
| 416 cmp(scratch, Operand(ExternalReference::new_space_start(isolate()))); | 415 cmp(scratch, Operand(ExternalReference::new_space_start(isolate()))); |
| 417 b(cond, branch); | 416 b(cond, branch); |
| 418 } | 417 } |
| 419 | 418 |
| (...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1278 void MacroAssembler::InvokeFunction(Handle<JSFunction> function, | 1277 void MacroAssembler::InvokeFunction(Handle<JSFunction> function, |
| 1279 const ParameterCount& expected, | 1278 const ParameterCount& expected, |
| 1280 const ParameterCount& actual, | 1279 const ParameterCount& actual, |
| 1281 InvokeFlag flag, | 1280 InvokeFlag flag, |
| 1282 const CallWrapper& call_wrapper, | 1281 const CallWrapper& call_wrapper, |
| 1283 CallKind call_kind) { | 1282 CallKind call_kind) { |
| 1284 // You can't call a function without a valid frame. | 1283 // You can't call a function without a valid frame. |
| 1285 ASSERT(flag == JUMP_FUNCTION || has_frame()); | 1284 ASSERT(flag == JUMP_FUNCTION || has_frame()); |
| 1286 | 1285 |
| 1287 // Get the function and setup the context. | 1286 // Get the function and setup the context. |
| 1288 LoadHeapObject(r1, function); | 1287 Move(r1, function); |
| 1289 ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); | 1288 ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
| 1290 | 1289 |
| 1291 // We call indirectly through the code field in the function to | 1290 // We call indirectly through the code field in the function to |
| 1292 // allow recompilation to take effect without changing any of the | 1291 // allow recompilation to take effect without changing any of the |
| 1293 // call sites. | 1292 // call sites. |
| 1294 ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); | 1293 ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); |
| 1295 InvokeCode(r3, expected, actual, flag, call_wrapper, call_kind); | 1294 InvokeCode(r3, expected, actual, flag, call_wrapper, call_kind); |
| 1296 } | 1295 } |
| 1297 | 1296 |
| 1298 | 1297 |
| (...skipping 2693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3992 void CodePatcher::EmitCondition(Condition cond) { | 3991 void CodePatcher::EmitCondition(Condition cond) { |
| 3993 Instr instr = Assembler::instr_at(masm_.pc_); | 3992 Instr instr = Assembler::instr_at(masm_.pc_); |
| 3994 instr = (instr & ~kCondMask) | cond; | 3993 instr = (instr & ~kCondMask) | cond; |
| 3995 masm_.emit(instr); | 3994 masm_.emit(instr); |
| 3996 } | 3995 } |
| 3997 | 3996 |
| 3998 | 3997 |
| 3999 } } // namespace v8::internal | 3998 } } // namespace v8::internal |
| 4000 | 3999 |
| 4001 #endif // V8_TARGET_ARCH_ARM | 4000 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |