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

Side by Side Diff: src/x64/lithium-x64.cc

Issue 149413010: A64: Synchronize with r16024. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 months 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/x64/lithium-x64.h ('k') | src/x64/macro-assembler-x64.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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 base_object()->PrintTo(stream); 268 base_object()->PrintTo(stream);
269 stream->Add(" + %d", offset()); 269 stream->Add(" + %d", offset());
270 } 270 }
271 271
272 272
273 void LCallConstantFunction::PrintDataTo(StringStream* stream) { 273 void LCallConstantFunction::PrintDataTo(StringStream* stream) {
274 stream->Add("#%d / ", arity()); 274 stream->Add("#%d / ", arity());
275 } 275 }
276 276
277 277
278 ExternalReference LLinkObjectInList::GetReference(Isolate* isolate) {
279 switch (hydrogen()->known_list()) {
280 case HLinkObjectInList::ALLOCATION_SITE_LIST:
281 return ExternalReference::allocation_sites_list_address(isolate);
282 }
283
284 UNREACHABLE();
285 // Return a dummy value
286 return ExternalReference::isolate_address(isolate);
287 }
288
289
290 void LLinkObjectInList::PrintDataTo(StringStream* stream) {
291 object()->PrintTo(stream);
292 stream->Add(" offset %d", hydrogen()->store_field().offset());
293 }
294
295
296 void LLoadContextSlot::PrintDataTo(StringStream* stream) { 278 void LLoadContextSlot::PrintDataTo(StringStream* stream) {
297 context()->PrintTo(stream); 279 context()->PrintTo(stream);
298 stream->Add("[%d]", slot_index()); 280 stream->Add("[%d]", slot_index());
299 } 281 }
300 282
301 283
302 void LStoreContextSlot::PrintDataTo(StringStream* stream) { 284 void LStoreContextSlot::PrintDataTo(StringStream* stream) {
303 context()->PrintTo(stream); 285 context()->PrintTo(stream);
304 stream->Add("[%d] <- ", slot_index()); 286 stream->Add("[%d] <- ", slot_index());
305 value()->PrintTo(stream); 287 value()->PrintTo(stream);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 HBasicBlock* next = NULL; 436 HBasicBlock* next = NULL;
455 if (i < blocks->length() - 1) next = blocks->at(i + 1); 437 if (i < blocks->length() - 1) next = blocks->at(i + 1);
456 DoBasicBlock(blocks->at(i), next); 438 DoBasicBlock(blocks->at(i), next);
457 if (is_aborted()) return NULL; 439 if (is_aborted()) return NULL;
458 } 440 }
459 status_ = DONE; 441 status_ = DONE;
460 return chunk_; 442 return chunk_;
461 } 443 }
462 444
463 445
464 void LCodeGen::Abort(const char* reason) { 446 void LCodeGen::Abort(BailoutReason reason) {
465 info()->set_bailout_reason(reason); 447 info()->set_bailout_reason(reason);
466 status_ = ABORTED; 448 status_ = ABORTED;
467 } 449 }
468 450
469 451
470 LUnallocated* LChunkBuilder::ToUnallocated(Register reg) { 452 LUnallocated* LChunkBuilder::ToUnallocated(Register reg) {
471 return new(zone()) LUnallocated(LUnallocated::FIXED_REGISTER, 453 return new(zone()) LUnallocated(LUnallocated::FIXED_REGISTER,
472 Register::ToAllocationIndex(reg)); 454 Register::ToAllocationIndex(reg));
473 } 455 }
474 456
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 instr->set_pointer_map(new(zone()) LPointerMap(position_, zone())); 647 instr->set_pointer_map(new(zone()) LPointerMap(position_, zone()));
666 return instr; 648 return instr;
667 } 649 }
668 650
669 651
670 LUnallocated* LChunkBuilder::TempRegister() { 652 LUnallocated* LChunkBuilder::TempRegister() {
671 LUnallocated* operand = 653 LUnallocated* operand =
672 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER); 654 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER);
673 int vreg = allocator_->GetVirtualRegister(); 655 int vreg = allocator_->GetVirtualRegister();
674 if (!allocator_->AllocationOk()) { 656 if (!allocator_->AllocationOk()) {
675 Abort("Out of virtual registers while trying to allocate temp register."); 657 Abort(kOutOfVirtualRegistersWhileTryingToAllocateTempRegister);
676 vreg = 0; 658 vreg = 0;
677 } 659 }
678 operand->set_virtual_register(vreg); 660 operand->set_virtual_register(vreg);
679 return operand; 661 return operand;
680 } 662 }
681 663
682 664
683 LOperand* LChunkBuilder::FixedTemp(Register reg) { 665 LOperand* LChunkBuilder::FixedTemp(Register reg) {
684 LUnallocated* operand = ToUnallocated(reg); 666 LUnallocated* operand = ToUnallocated(reg);
685 ASSERT(operand->HasFixedPolicy()); 667 ASSERT(operand->HasFixedPolicy());
(...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after
1990 1972
1991 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { 1973 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) {
1992 Representation r = instr->representation(); 1974 Representation r = instr->representation();
1993 if (r.IsSmi()) { 1975 if (r.IsSmi()) {
1994 return DefineAsRegister(new(zone()) LConstantS); 1976 return DefineAsRegister(new(zone()) LConstantS);
1995 } else if (r.IsInteger32()) { 1977 } else if (r.IsInteger32()) {
1996 return DefineAsRegister(new(zone()) LConstantI); 1978 return DefineAsRegister(new(zone()) LConstantI);
1997 } else if (r.IsDouble()) { 1979 } else if (r.IsDouble()) {
1998 LOperand* temp = TempRegister(); 1980 LOperand* temp = TempRegister();
1999 return DefineAsRegister(new(zone()) LConstantD(temp)); 1981 return DefineAsRegister(new(zone()) LConstantD(temp));
1982 } else if (r.IsExternal()) {
1983 return DefineAsRegister(new(zone()) LConstantE);
2000 } else if (r.IsTagged()) { 1984 } else if (r.IsTagged()) {
2001 return DefineAsRegister(new(zone()) LConstantT); 1985 return DefineAsRegister(new(zone()) LConstantT);
2002 } else { 1986 } else {
2003 UNREACHABLE(); 1987 UNREACHABLE();
2004 return NULL; 1988 return NULL;
2005 } 1989 }
2006 } 1990 }
2007 1991
2008 1992
2009 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) { 1993 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) {
(...skipping 23 matching lines...) Expand all
2033 2017
2034 LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) { 2018 LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) {
2035 LOperand* global_object = UseFixed(instr->global_object(), rdx); 2019 LOperand* global_object = UseFixed(instr->global_object(), rdx);
2036 LOperand* value = UseFixed(instr->value(), rax); 2020 LOperand* value = UseFixed(instr->value(), rax);
2037 LStoreGlobalGeneric* result = new(zone()) LStoreGlobalGeneric(global_object, 2021 LStoreGlobalGeneric* result = new(zone()) LStoreGlobalGeneric(global_object,
2038 value); 2022 value);
2039 return MarkAsCall(result, instr); 2023 return MarkAsCall(result, instr);
2040 } 2024 }
2041 2025
2042 2026
2043 LInstruction* LChunkBuilder::DoLinkObjectInList(HLinkObjectInList* instr) {
2044 LOperand* object = UseRegister(instr->value());
2045 LLinkObjectInList* result = new(zone()) LLinkObjectInList(object);
2046 return result;
2047 }
2048
2049
2050 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) { 2027 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) {
2051 LOperand* context = UseRegisterAtStart(instr->value()); 2028 LOperand* context = UseRegisterAtStart(instr->value());
2052 LInstruction* result = 2029 LInstruction* result =
2053 DefineAsRegister(new(zone()) LLoadContextSlot(context)); 2030 DefineAsRegister(new(zone()) LLoadContextSlot(context));
2054 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; 2031 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result;
2055 } 2032 }
2056 2033
2057 2034
2058 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) { 2035 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) {
2059 LOperand* context; 2036 LOperand* context;
2060 LOperand* value; 2037 LOperand* value;
2061 LOperand* temp; 2038 LOperand* temp;
2062 if (instr->NeedsWriteBarrier()) { 2039 if (instr->NeedsWriteBarrier()) {
2063 context = UseTempRegister(instr->context()); 2040 context = UseTempRegister(instr->context());
2064 value = UseTempRegister(instr->value()); 2041 value = UseTempRegister(instr->value());
2065 temp = TempRegister(); 2042 temp = TempRegister();
2066 } else { 2043 } else {
2067 context = UseRegister(instr->context()); 2044 context = UseRegister(instr->context());
2068 value = UseRegister(instr->value()); 2045 value = UseRegister(instr->value());
2069 temp = NULL; 2046 temp = NULL;
2070 } 2047 }
2071 LInstruction* result = new(zone()) LStoreContextSlot(context, value, temp); 2048 LInstruction* result = new(zone()) LStoreContextSlot(context, value, temp);
2072 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; 2049 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result;
2073 } 2050 }
2074 2051
2075 2052
2076 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { 2053 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) {
2054 if (instr->access().IsExternalMemory() && instr->access().offset() == 0) {
2055 LOperand* obj = UseRegisterOrConstantAtStart(instr->object());
2056 return DefineFixed(new(zone()) LLoadNamedField(obj), rax);
2057 }
2077 LOperand* obj = UseRegisterAtStart(instr->object()); 2058 LOperand* obj = UseRegisterAtStart(instr->object());
2078 return DefineAsRegister(new(zone()) LLoadNamedField(obj)); 2059 return DefineAsRegister(new(zone()) LLoadNamedField(obj));
2079 } 2060 }
2080 2061
2081 2062
2082 LInstruction* LChunkBuilder::DoLoadNamedFieldPolymorphic( 2063 LInstruction* LChunkBuilder::DoLoadNamedFieldPolymorphic(
2083 HLoadNamedFieldPolymorphic* instr) { 2064 HLoadNamedFieldPolymorphic* instr) {
2084 ASSERT(instr->representation().IsTagged()); 2065 ASSERT(instr->representation().IsTagged());
2085 if (instr->need_generic()) { 2066 if (instr->need_generic()) {
2086 LOperand* obj = UseFixed(instr->object(), rax); 2067 LOperand* obj = UseFixed(instr->object(), rax);
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
2242 LOperand* object = UseRegister(instr->object()); 2223 LOperand* object = UseRegister(instr->object());
2243 LOperand* temp = TempRegister(); 2224 LOperand* temp = TempRegister();
2244 LTrapAllocationMemento* result = 2225 LTrapAllocationMemento* result =
2245 new(zone()) LTrapAllocationMemento(object, temp); 2226 new(zone()) LTrapAllocationMemento(object, temp);
2246 return AssignEnvironment(result); 2227 return AssignEnvironment(result);
2247 } 2228 }
2248 2229
2249 2230
2250 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { 2231 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) {
2251 bool is_in_object = instr->access().IsInobject(); 2232 bool is_in_object = instr->access().IsInobject();
2233 bool is_external_location = instr->access().IsExternalMemory() &&
2234 instr->access().offset() == 0;
2252 bool needs_write_barrier = instr->NeedsWriteBarrier(); 2235 bool needs_write_barrier = instr->NeedsWriteBarrier();
2253 bool needs_write_barrier_for_map = !instr->transition().is_null() && 2236 bool needs_write_barrier_for_map = !instr->transition().is_null() &&
2254 instr->NeedsWriteBarrierForMap(); 2237 instr->NeedsWriteBarrierForMap();
2255 2238
2256 LOperand* obj; 2239 LOperand* obj;
2257 if (needs_write_barrier) { 2240 if (needs_write_barrier) {
2258 obj = is_in_object 2241 obj = is_in_object
2259 ? UseRegister(instr->object()) 2242 ? UseRegister(instr->object())
2260 : UseTempRegister(instr->object()); 2243 : UseTempRegister(instr->object());
2244 } else if (is_external_location) {
2245 ASSERT(!is_in_object);
2246 ASSERT(!needs_write_barrier);
2247 ASSERT(!needs_write_barrier_for_map);
2248 obj = UseRegisterOrConstant(instr->object());
2261 } else { 2249 } else {
2262 obj = needs_write_barrier_for_map 2250 obj = needs_write_barrier_for_map
2263 ? UseRegister(instr->object()) 2251 ? UseRegister(instr->object())
2264 : UseRegisterAtStart(instr->object()); 2252 : UseRegisterAtStart(instr->object());
2265 } 2253 }
2266 2254
2267 bool can_be_constant = instr->value()->IsConstant() && 2255 bool can_be_constant = instr->value()->IsConstant() &&
2268 HConstant::cast(instr->value())->NotInNewSpace() && 2256 HConstant::cast(instr->value())->NotInNewSpace() &&
2269 !(FLAG_track_double_fields && instr->field_representation().IsDouble()); 2257 !(FLAG_track_double_fields && instr->field_representation().IsDouble());
2270 2258
2271 LOperand* val; 2259 LOperand* val;
2272 if (needs_write_barrier) { 2260 if (needs_write_barrier) {
2273 val = UseTempRegister(instr->value()); 2261 val = UseTempRegister(instr->value());
2262 } else if (is_external_location) {
2263 val = UseFixed(instr->value(), rax);
2274 } else if (can_be_constant) { 2264 } else if (can_be_constant) {
2275 val = UseRegisterOrConstant(instr->value()); 2265 val = UseRegisterOrConstant(instr->value());
2276 } else if (FLAG_track_fields && instr->field_representation().IsSmi()) { 2266 } else if (FLAG_track_fields && instr->field_representation().IsSmi()) {
2277 val = UseTempRegister(instr->value()); 2267 val = UseTempRegister(instr->value());
2278 } else if (FLAG_track_double_fields && 2268 } else if (FLAG_track_double_fields &&
2279 instr->field_representation().IsDouble()) { 2269 instr->field_representation().IsDouble()) {
2280 val = UseRegisterAtStart(instr->value()); 2270 val = UseRegisterAtStart(instr->value());
2281 } else { 2271 } else {
2282 val = UseRegister(instr->value()); 2272 val = UseRegister(instr->value());
2283 } 2273 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
2323 } 2313 }
2324 2314
2325 2315
2326 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) { 2316 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) {
2327 LOperand* char_code = UseRegister(instr->value()); 2317 LOperand* char_code = UseRegister(instr->value());
2328 LStringCharFromCode* result = new(zone()) LStringCharFromCode(char_code); 2318 LStringCharFromCode* result = new(zone()) LStringCharFromCode(char_code);
2329 return AssignPointerMap(DefineAsRegister(result)); 2319 return AssignPointerMap(DefineAsRegister(result));
2330 } 2320 }
2331 2321
2332 2322
2333 LInstruction* LChunkBuilder::DoStringLength(HStringLength* instr) {
2334 LOperand* string = UseRegisterAtStart(instr->value());
2335 return DefineAsRegister(new(zone()) LStringLength(string));
2336 }
2337
2338
2339 LInstruction* LChunkBuilder::DoAllocate(HAllocate* instr) { 2323 LInstruction* LChunkBuilder::DoAllocate(HAllocate* instr) {
2340 info()->MarkAsDeferredCalling(); 2324 info()->MarkAsDeferredCalling();
2341 LOperand* size = instr->size()->IsConstant() 2325 LOperand* size = instr->size()->IsConstant()
2342 ? UseConstant(instr->size()) 2326 ? UseConstant(instr->size())
2343 : UseTempRegister(instr->size()); 2327 : UseTempRegister(instr->size());
2344 LOperand* temp = TempRegister(); 2328 LOperand* temp = TempRegister();
2345 LAllocate* result = new(zone()) LAllocate(size, temp); 2329 LAllocate* result = new(zone()) LAllocate(size, temp);
2346 return AssignPointerMap(DefineAsRegister(result)); 2330 return AssignPointerMap(DefineAsRegister(result));
2347 } 2331 }
2348 2332
(...skipping 28 matching lines...) Expand all
2377 int index = static_cast<int>(instr->index()); 2361 int index = static_cast<int>(instr->index());
2378 Register reg = DESCRIPTOR_GET_PARAMETER_REGISTER(descriptor, index); 2362 Register reg = DESCRIPTOR_GET_PARAMETER_REGISTER(descriptor, index);
2379 return DefineFixed(result, reg); 2363 return DefineFixed(result, reg);
2380 } 2364 }
2381 } 2365 }
2382 2366
2383 2367
2384 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) { 2368 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) {
2385 int spill_index = chunk()->GetNextSpillIndex(false); // Not double-width. 2369 int spill_index = chunk()->GetNextSpillIndex(false); // Not double-width.
2386 if (spill_index > LUnallocated::kMaxFixedSlotIndex) { 2370 if (spill_index > LUnallocated::kMaxFixedSlotIndex) {
2387 Abort("Too many spill slots needed for OSR"); 2371 Abort(kTooManySpillSlotsNeededForOSR);
2388 spill_index = 0; 2372 spill_index = 0;
2389 } 2373 }
2390 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); 2374 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index);
2391 } 2375 }
2392 2376
2393 2377
2394 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) { 2378 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) {
2395 argument_count_ -= instr->argument_count(); 2379 argument_count_ -= instr->argument_count();
2396 return MarkAsCall(DefineFixed(new(zone()) LCallStub, rax), instr); 2380 return MarkAsCall(DefineFixed(new(zone()) LCallStub, rax), instr);
2397 } 2381 }
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
2554 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2538 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2555 LOperand* object = UseRegister(instr->object()); 2539 LOperand* object = UseRegister(instr->object());
2556 LOperand* index = UseTempRegister(instr->index()); 2540 LOperand* index = UseTempRegister(instr->index());
2557 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2541 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2558 } 2542 }
2559 2543
2560 2544
2561 } } // namespace v8::internal 2545 } } // namespace v8::internal
2562 2546
2563 #endif // V8_TARGET_ARCH_X64 2547 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/lithium-x64.h ('k') | src/x64/macro-assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698