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

Side by Side Diff: src/ia32/lithium-codegen-ia32.cc

Issue 7170012: Crankshaft support for polymorphic array handling (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: address comments; add implemention for ARM and x64 Created 9 years, 6 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
OLDNEW
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 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1206 } 1206 }
1207 1207
1208 1208
1209 void LCodeGen::DoExternalArrayLength(LExternalArrayLength* instr) { 1209 void LCodeGen::DoExternalArrayLength(LExternalArrayLength* instr) {
1210 Register result = ToRegister(instr->result()); 1210 Register result = ToRegister(instr->result());
1211 Register array = ToRegister(instr->InputAt(0)); 1211 Register array = ToRegister(instr->InputAt(0));
1212 __ mov(result, FieldOperand(array, ExternalArray::kLengthOffset)); 1212 __ mov(result, FieldOperand(array, ExternalArray::kLengthOffset));
1213 } 1213 }
1214 1214
1215 1215
1216 void LCodeGen::DoElementsKind(LElementsKind* instr) {
1217 Register result = ToRegister(instr->result());
1218 Register input = ToRegister(instr->InputAt(0));
1219
1220 // Load map into |result|.
1221 __ mov(result, FieldOperand(input, HeapObject::kMapOffset));
1222 // Load the map's "bit field 2" into |result|. We only need the first byte,
1223 // but the following masking takes care of that anyway.
1224 __ mov(result, FieldOperand(result, Map::kBitField2Offset));
1225 // Retrieve elements_kind from bit field 2.
1226 __ and_(result, Map::kElementsKindMask);
1227 __ shr(result, Map::kElementsKindShift);
1228 }
1229
1230
1216 void LCodeGen::DoValueOf(LValueOf* instr) { 1231 void LCodeGen::DoValueOf(LValueOf* instr) {
1217 Register input = ToRegister(instr->InputAt(0)); 1232 Register input = ToRegister(instr->InputAt(0));
1218 Register result = ToRegister(instr->result()); 1233 Register result = ToRegister(instr->result());
1219 Register map = ToRegister(instr->TempAt(0)); 1234 Register map = ToRegister(instr->TempAt(0));
1220 ASSERT(input.is(result)); 1235 ASSERT(input.is(result));
1221 Label done; 1236 Label done;
1222 // If the object is a smi return the object. 1237 // If the object is a smi return the object.
1223 __ test(input, Immediate(kSmiTagMask)); 1238 __ test(input, Immediate(kSmiTagMask));
1224 __ j(zero, &done, Label::kNear); 1239 __ j(zero, &done, Label::kNear);
1225 1240
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
1576 Register left = ToRegister(instr->InputAt(0)); 1591 Register left = ToRegister(instr->InputAt(0));
1577 Register right = ToRegister(instr->InputAt(1)); 1592 Register right = ToRegister(instr->InputAt(1));
1578 int false_block = chunk_->LookupDestination(instr->false_block_id()); 1593 int false_block = chunk_->LookupDestination(instr->false_block_id());
1579 int true_block = chunk_->LookupDestination(instr->true_block_id()); 1594 int true_block = chunk_->LookupDestination(instr->true_block_id());
1580 1595
1581 __ cmp(left, Operand(right)); 1596 __ cmp(left, Operand(right));
1582 EmitBranch(true_block, false_block, equal); 1597 EmitBranch(true_block, false_block, equal);
1583 } 1598 }
1584 1599
1585 1600
1601 void LCodeGen::DoCmpConstantEq(LCmpConstantEq* instr) {
1602 Register left = ToRegister(instr->InputAt(0));
1603 Register result = ToRegister(instr->result());
1604
1605 Label done;
1606 __ cmp(left, instr->hydrogen()->right());
1607 __ mov(result, factory()->true_value());
1608 __ j(equal, &done, Label::kNear);
1609 __ mov(result, factory()->false_value());
1610 __ bind(&done);
1611 }
1612
1613
1614 void LCodeGen::DoCmpConstantEqAndBranch(LCmpConstantEqAndBranch* instr) {
1615 Register left = ToRegister(instr->InputAt(0));
1616 int true_block = chunk_->LookupDestination(instr->true_block_id());
1617 int false_block = chunk_->LookupDestination(instr->false_block_id());
1618
1619 __ cmp(left, instr->hydrogen()->right());
1620 EmitBranch(true_block, false_block, equal);
1621 }
1622
1623
1586 void LCodeGen::DoIsNull(LIsNull* instr) { 1624 void LCodeGen::DoIsNull(LIsNull* instr) {
1587 Register reg = ToRegister(instr->InputAt(0)); 1625 Register reg = ToRegister(instr->InputAt(0));
1588 Register result = ToRegister(instr->result()); 1626 Register result = ToRegister(instr->result());
1589 1627
1590 // TODO(fsc): If the expression is known to be a smi, then it's 1628 // TODO(fsc): If the expression is known to be a smi, then it's
1591 // definitely not null. Materialize false. 1629 // definitely not null. Materialize false.
1592 1630
1593 __ cmp(reg, factory()->null_value()); 1631 __ cmp(reg, factory()->null_value());
1594 if (instr->is_strict()) { 1632 if (instr->is_strict()) {
1595 __ mov(result, factory()->true_value()); 1633 __ mov(result, factory()->true_value());
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
2369 // All done. 2407 // All done.
2370 __ bind(&done); 2408 __ bind(&done);
2371 } 2409 }
2372 2410
2373 2411
2374 void LCodeGen::DoLoadElements(LLoadElements* instr) { 2412 void LCodeGen::DoLoadElements(LLoadElements* instr) {
2375 Register result = ToRegister(instr->result()); 2413 Register result = ToRegister(instr->result());
2376 Register input = ToRegister(instr->InputAt(0)); 2414 Register input = ToRegister(instr->InputAt(0));
2377 __ mov(result, FieldOperand(input, JSObject::kElementsOffset)); 2415 __ mov(result, FieldOperand(input, JSObject::kElementsOffset));
2378 if (FLAG_debug_code) { 2416 if (FLAG_debug_code) {
2379 Label done; 2417 Label done, ok, fail;
2380 __ cmp(FieldOperand(result, HeapObject::kMapOffset), 2418 __ cmp(FieldOperand(result, HeapObject::kMapOffset),
2381 Immediate(factory()->fixed_array_map())); 2419 Immediate(factory()->fixed_array_map()));
2382 __ j(equal, &done, Label::kNear); 2420 __ j(equal, &done, Label::kNear);
2383 __ cmp(FieldOperand(result, HeapObject::kMapOffset), 2421 __ cmp(FieldOperand(result, HeapObject::kMapOffset),
2384 Immediate(factory()->fixed_cow_array_map())); 2422 Immediate(factory()->fixed_cow_array_map()));
2385 __ j(equal, &done, Label::kNear); 2423 __ j(equal, &done, Label::kNear);
2386 Register temp((result.is(eax)) ? ebx : eax); 2424 Register temp((result.is(eax)) ? ebx : eax);
2387 __ push(temp); 2425 __ push(temp);
2388 __ mov(temp, FieldOperand(result, HeapObject::kMapOffset)); 2426 __ mov(temp, FieldOperand(result, HeapObject::kMapOffset));
2389 __ movzx_b(temp, FieldOperand(temp, Map::kInstanceTypeOffset)); 2427 __ movzx_b(temp, FieldOperand(temp, Map::kBitField2Offset));
2390 __ sub(Operand(temp), Immediate(FIRST_EXTERNAL_ARRAY_TYPE)); 2428 __ and_(temp, Map::kElementsKindMask);
2391 __ cmp(Operand(temp), Immediate(kExternalArrayTypeCount)); 2429 __ shr(temp, Map::kElementsKindShift);
2430 __ cmp(temp, JSObject::FAST_ELEMENTS);
2431 __ j(equal, &ok, Label::kNear);
2432 __ cmp(temp, JSObject::FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND);
2433 __ j(less, &fail, Label::kNear);
2434 __ cmp(temp, JSObject::LAST_EXTERNAL_ARRAY_ELEMENTS_KIND);
2435 __ j(less_equal, &ok, Label::kNear);
2436 __ bind(&fail);
2437 __ Abort("Check for fast or external elements failed.");
2438 __ bind(&ok);
2392 __ pop(temp); 2439 __ pop(temp);
2393 __ Check(below, "Check for fast elements or pixel array failed.");
2394 __ bind(&done); 2440 __ bind(&done);
2395 } 2441 }
2396 } 2442 }
2397 2443
2398 2444
2399 void LCodeGen::DoLoadExternalArrayPointer( 2445 void LCodeGen::DoLoadExternalArrayPointer(
2400 LLoadExternalArrayPointer* instr) { 2446 LLoadExternalArrayPointer* instr) {
2401 Register result = ToRegister(instr->result()); 2447 Register result = ToRegister(instr->result());
2402 Register input = ToRegister(instr->InputAt(0)); 2448 Register input = ToRegister(instr->InputAt(0));
2403 __ mov(result, FieldOperand(input, 2449 __ mov(result, FieldOperand(input,
(...skipping 2055 matching lines...) Expand 10 before | Expand all | Expand 10 after
4459 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 4505 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
4460 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); 4506 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator);
4461 } 4507 }
4462 4508
4463 4509
4464 #undef __ 4510 #undef __
4465 4511
4466 } } // namespace v8::internal 4512 } } // namespace v8::internal
4467 4513
4468 #endif // V8_TARGET_ARCH_IA32 4514 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698