Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(421)

Side by Side Diff: src/arm/macro-assembler-arm.cc

Issue 112863002: Merge bleeding_edge 18021:18297 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/arm/simulator-arm.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 LinkRegisterStatus lr_status, 508 LinkRegisterStatus lr_status,
510 SaveFPRegsMode fp_mode, 509 SaveFPRegsMode fp_mode,
511 RememberedSetAction remembered_set_action, 510 RememberedSetAction remembered_set_action,
512 SmiCheck smi_check) { 511 SmiCheck smi_check) {
513 if (emit_debug_code()) { 512 if (emit_debug_code()) {
514 ldr(ip, MemOperand(address)); 513 ldr(ip, MemOperand(address));
515 cmp(ip, value); 514 cmp(ip, value);
516 Check(eq, kWrongAddressOrValuePassedToRecordWrite); 515 Check(eq, kWrongAddressOrValuePassedToRecordWrite);
517 } 516 }
518 517
518 // Count number of write barriers in generated code.
519 isolate()->counters()->write_barriers_static()->Increment();
520 // TODO(mstarzinger): Dynamic counter missing.
521
522 // First, check if a write barrier is even needed. The tests below
523 // catch stores of smis and stores into the young generation.
519 Label done; 524 Label done;
520 525
521 if (smi_check == INLINE_SMI_CHECK) { 526 if (smi_check == INLINE_SMI_CHECK) {
522 JumpIfSmi(value, &done); 527 JumpIfSmi(value, &done);
523 } 528 }
524 529
525 CheckPageFlag(value, 530 CheckPageFlag(value,
526 value, // Used as scratch. 531 value, // Used as scratch.
527 MemoryChunk::kPointersToHereAreInterestingMask, 532 MemoryChunk::kPointersToHereAreInterestingMask,
528 eq, 533 eq,
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 SharedFunctionInfo::kFormalParameterCountOffset)); 1221 SharedFunctionInfo::kFormalParameterCountOffset));
1217 SmiUntag(expected_reg); 1222 SmiUntag(expected_reg);
1218 ldr(code_reg, 1223 ldr(code_reg,
1219 FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); 1224 FieldMemOperand(r1, JSFunction::kCodeEntryOffset));
1220 1225
1221 ParameterCount expected(expected_reg); 1226 ParameterCount expected(expected_reg);
1222 InvokeCode(code_reg, expected, actual, flag, call_wrapper, call_kind); 1227 InvokeCode(code_reg, expected, actual, flag, call_wrapper, call_kind);
1223 } 1228 }
1224 1229
1225 1230
1226 void MacroAssembler::InvokeFunction(Handle<JSFunction> function, 1231 void MacroAssembler::InvokeFunction(Register function,
1227 const ParameterCount& expected, 1232 const ParameterCount& expected,
1228 const ParameterCount& actual, 1233 const ParameterCount& actual,
1229 InvokeFlag flag, 1234 InvokeFlag flag,
1230 const CallWrapper& call_wrapper, 1235 const CallWrapper& call_wrapper,
1231 CallKind call_kind) { 1236 CallKind call_kind) {
1232 // You can't call a function without a valid frame. 1237 // You can't call a function without a valid frame.
1233 ASSERT(flag == JUMP_FUNCTION || has_frame()); 1238 ASSERT(flag == JUMP_FUNCTION || has_frame());
1234 1239
1240 // Contract with called JS functions requires that function is passed in r1.
1241 ASSERT(function.is(r1));
1242
1235 // Get the function and setup the context. 1243 // Get the function and setup the context.
1236 Move(r1, function);
1237 ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); 1244 ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
1238 1245
1239 // We call indirectly through the code field in the function to 1246 // We call indirectly through the code field in the function to
1240 // allow recompilation to take effect without changing any of the 1247 // allow recompilation to take effect without changing any of the
1241 // call sites. 1248 // call sites.
1242 ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); 1249 ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset));
1243 InvokeCode(r3, expected, actual, flag, call_wrapper, call_kind); 1250 InvokeCode(r3, expected, actual, flag, call_wrapper, call_kind);
1244 } 1251 }
1245 1252
1246 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
1247 void MacroAssembler::IsObjectJSObjectType(Register heap_object, 1265 void MacroAssembler::IsObjectJSObjectType(Register heap_object,
1248 Register map, 1266 Register map,
1249 Register scratch, 1267 Register scratch,
1250 Label* fail) { 1268 Label* fail) {
1251 ldr(map, FieldMemOperand(heap_object, HeapObject::kMapOffset)); 1269 ldr(map, FieldMemOperand(heap_object, HeapObject::kMapOffset));
1252 IsInstanceJSObjectType(map, scratch, fail); 1270 IsInstanceJSObjectType(map, scratch, fail);
1253 } 1271 }
1254 1272
1255 1273
1256 void MacroAssembler::IsInstanceJSObjectType(Register map, 1274 void MacroAssembler::IsInstanceJSObjectType(Register map,
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
2009 Heap::kSlicedAsciiStringMapRootIndex, 2027 Heap::kSlicedAsciiStringMapRootIndex,
2010 scratch1, 2028 scratch1,
2011 scratch2); 2029 scratch2);
2012 } 2030 }
2013 2031
2014 2032
2015 void MacroAssembler::CompareObjectType(Register object, 2033 void MacroAssembler::CompareObjectType(Register object,
2016 Register map, 2034 Register map,
2017 Register type_reg, 2035 Register type_reg,
2018 InstanceType type) { 2036 InstanceType type) {
2037 const Register temp = type_reg.is(no_reg) ? ip : type_reg;
2038
2019 ldr(map, FieldMemOperand(object, HeapObject::kMapOffset)); 2039 ldr(map, FieldMemOperand(object, HeapObject::kMapOffset));
2020 CompareInstanceType(map, type_reg, type); 2040 CompareInstanceType(map, temp, type);
2041 }
2042
2043
2044 void MacroAssembler::CheckObjectTypeRange(Register object,
2045 Register map,
2046 InstanceType min_type,
2047 InstanceType max_type,
2048 Label* false_label) {
2049 STATIC_ASSERT(Map::kInstanceTypeOffset < 4096);
2050 STATIC_ASSERT(LAST_TYPE < 256);
2051 ldr(map, FieldMemOperand(object, HeapObject::kMapOffset));
2052 ldrb(ip, FieldMemOperand(map, Map::kInstanceTypeOffset));
2053 sub(ip, ip, Operand(min_type));
2054 cmp(ip, Operand(max_type - min_type));
2055 b(hi, false_label);
2021 } 2056 }
2022 2057
2023 2058
2024 void MacroAssembler::CompareInstanceType(Register map, 2059 void MacroAssembler::CompareInstanceType(Register map,
2025 Register type_reg, 2060 Register type_reg,
2026 InstanceType type) { 2061 InstanceType type) {
2062 // Registers map and type_reg can be ip. These two lines assert
2063 // that ip can be used with the two instructions (the constants
2064 // will never need ip).
2065 STATIC_ASSERT(Map::kInstanceTypeOffset < 4096);
2066 STATIC_ASSERT(LAST_TYPE < 256);
2027 ldrb(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset)); 2067 ldrb(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset));
2028 cmp(type_reg, Operand(type)); 2068 cmp(type_reg, Operand(type));
2029 } 2069 }
2030 2070
2031 2071
2032 void MacroAssembler::CompareRoot(Register obj, 2072 void MacroAssembler::CompareRoot(Register obj,
2033 Heap::RootListIndex index) { 2073 Heap::RootListIndex index) {
2034 ASSERT(!obj.is(ip)); 2074 ASSERT(!obj.is(ip));
2035 LoadRoot(ip, index); 2075 LoadRoot(ip, index);
2036 cmp(obj, ip); 2076 cmp(obj, ip);
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
2241 2281
2242 void MacroAssembler::CallStub(CodeStub* stub, 2282 void MacroAssembler::CallStub(CodeStub* stub,
2243 TypeFeedbackId ast_id, 2283 TypeFeedbackId ast_id,
2244 Condition cond) { 2284 Condition cond) {
2245 ASSERT(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs. 2285 ASSERT(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs.
2246 Call(stub->GetCode(isolate()), RelocInfo::CODE_TARGET, ast_id, cond); 2286 Call(stub->GetCode(isolate()), RelocInfo::CODE_TARGET, ast_id, cond);
2247 } 2287 }
2248 2288
2249 2289
2250 void MacroAssembler::TailCallStub(CodeStub* stub, Condition cond) { 2290 void MacroAssembler::TailCallStub(CodeStub* stub, Condition cond) {
2251 ASSERT(allow_stub_calls_ ||
2252 stub->CompilingCallsToThisStubIsGCSafe(isolate()));
2253 Jump(stub->GetCode(isolate()), RelocInfo::CODE_TARGET, cond); 2291 Jump(stub->GetCode(isolate()), RelocInfo::CODE_TARGET, cond);
2254 } 2292 }
2255 2293
2256 2294
2257 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { 2295 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) {
2258 return ref0.address() - ref1.address(); 2296 return ref0.address() - ref1.address();
2259 } 2297 }
2260 2298
2261 2299
2262 void MacroAssembler::CallApiFunctionAndReturn( 2300 void MacroAssembler::CallApiFunctionAndReturn(
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
2387 PrepareCallCFunction(1, r5); 2425 PrepareCallCFunction(1, r5);
2388 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); 2426 mov(r0, Operand(ExternalReference::isolate_address(isolate())));
2389 CallCFunction( 2427 CallCFunction(
2390 ExternalReference::delete_handle_scope_extensions(isolate()), 1); 2428 ExternalReference::delete_handle_scope_extensions(isolate()), 1);
2391 mov(r0, r4); 2429 mov(r0, r4);
2392 jmp(&leave_exit_frame); 2430 jmp(&leave_exit_frame);
2393 } 2431 }
2394 2432
2395 2433
2396 bool MacroAssembler::AllowThisStubCall(CodeStub* stub) { 2434 bool MacroAssembler::AllowThisStubCall(CodeStub* stub) {
2397 if (!has_frame_ && stub->SometimesSetsUpAFrame()) return false; 2435 return has_frame_ || !stub->SometimesSetsUpAFrame();
2398 return allow_stub_calls_ || stub->CompilingCallsToThisStubIsGCSafe(isolate());
2399 } 2436 }
2400 2437
2401 2438
2402 void MacroAssembler::IllegalOperation(int num_arguments) { 2439 void MacroAssembler::IllegalOperation(int num_arguments) {
2403 if (num_arguments > 0) { 2440 if (num_arguments > 0) {
2404 add(sp, sp, Operand(num_arguments * kPointerSize)); 2441 add(sp, sp, Operand(num_arguments * kPointerSize));
2405 } 2442 }
2406 LoadRoot(r0, Heap::kUndefinedValueRootIndex); 2443 LoadRoot(r0, Heap::kUndefinedValueRootIndex);
2407 } 2444 }
2408 2445
(...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after
3449 } 3486 }
3450 3487
3451 3488
3452 void MacroAssembler::PrepareCallCFunction(int num_reg_arguments, 3489 void MacroAssembler::PrepareCallCFunction(int num_reg_arguments,
3453 Register scratch) { 3490 Register scratch) {
3454 PrepareCallCFunction(num_reg_arguments, 0, scratch); 3491 PrepareCallCFunction(num_reg_arguments, 0, scratch);
3455 } 3492 }
3456 3493
3457 3494
3458 void MacroAssembler::SetCallCDoubleArguments(DwVfpRegister dreg) { 3495 void MacroAssembler::SetCallCDoubleArguments(DwVfpRegister dreg) {
3459 if (use_eabi_hardfloat()) { 3496 ASSERT(dreg.is(d0));
3460 Move(d0, dreg); 3497 if (!use_eabi_hardfloat()) {
3461 } else {
3462 vmov(r0, r1, dreg); 3498 vmov(r0, r1, dreg);
3463 } 3499 }
3464 } 3500 }
3465 3501
3466 3502
3467 void MacroAssembler::SetCallCDoubleArguments(DwVfpRegister dreg1, 3503 void MacroAssembler::SetCallCDoubleArguments(DwVfpRegister dreg1,
3468 DwVfpRegister dreg2) { 3504 DwVfpRegister dreg2) {
3469 if (use_eabi_hardfloat()) { 3505 ASSERT(dreg1.is(d0));
3470 if (dreg2.is(d0)) { 3506 ASSERT(dreg2.is(d1));
3471 ASSERT(!dreg1.is(d1)); 3507 if (!use_eabi_hardfloat()) {
3472 Move(d1, dreg2);
3473 Move(d0, dreg1);
3474 } else {
3475 Move(d0, dreg1);
3476 Move(d1, dreg2);
3477 }
3478 } else {
3479 vmov(r0, r1, dreg1); 3508 vmov(r0, r1, dreg1);
3480 vmov(r2, r3, dreg2); 3509 vmov(r2, r3, dreg2);
3481 } 3510 }
3482 } 3511 }
3483 3512
3484 3513
3485 void MacroAssembler::SetCallCDoubleArguments(DwVfpRegister dreg, 3514 void MacroAssembler::SetCallCDoubleArguments(DwVfpRegister dreg,
3486 Register reg) { 3515 Register reg) {
3516 ASSERT(dreg.is(d0));
3487 if (use_eabi_hardfloat()) { 3517 if (use_eabi_hardfloat()) {
3488 Move(d0, dreg);
3489 Move(r0, reg); 3518 Move(r0, reg);
3490 } else { 3519 } else {
3491 Move(r2, reg); 3520 Move(r2, reg);
3492 vmov(r0, r1, dreg); 3521 vmov(r0, r1, dreg);
3493 } 3522 }
3494 } 3523 }
3495 3524
3496 3525
3497 void MacroAssembler::CallCFunction(ExternalReference function, 3526 void MacroAssembler::CallCFunction(ExternalReference function,
3498 int num_reg_arguments, 3527 int num_reg_arguments,
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
4050 void CodePatcher::EmitCondition(Condition cond) { 4079 void CodePatcher::EmitCondition(Condition cond) {
4051 Instr instr = Assembler::instr_at(masm_.pc_); 4080 Instr instr = Assembler::instr_at(masm_.pc_);
4052 instr = (instr & ~kCondMask) | cond; 4081 instr = (instr & ~kCondMask) | cond;
4053 masm_.emit(instr); 4082 masm_.emit(instr);
4054 } 4083 }
4055 4084
4056 4085
4057 } } // namespace v8::internal 4086 } } // namespace v8::internal
4058 4087
4059 #endif // V8_TARGET_ARCH_ARM 4088 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/arm/simulator-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698