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

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

Issue 9425045: Support fast case for-in in Crankshaft. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: port to x64&arm, cleanup Created 8 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
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 4435 matching lines...) Expand 10 before | Expand all | Expand 10 after
4446 instr->SpilledDoubleRegisterArray()); 4446 instr->SpilledDoubleRegisterArray());
4447 4447
4448 // If the environment were already registered, we would have no way of 4448 // If the environment were already registered, we would have no way of
4449 // backpatching it with the spill slot operands. 4449 // backpatching it with the spill slot operands.
4450 ASSERT(!environment->HasBeenRegistered()); 4450 ASSERT(!environment->HasBeenRegistered());
4451 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); 4451 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
4452 ASSERT(osr_pc_offset_ == -1); 4452 ASSERT(osr_pc_offset_ == -1);
4453 osr_pc_offset_ = masm()->pc_offset(); 4453 osr_pc_offset_ = masm()->pc_offset();
4454 } 4454 }
4455 4455
4456
4457 void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) {
4458 __ CompareRoot(rax, Heap::kUndefinedValueRootIndex);
4459 DeoptimizeIf(equal, instr->environment());
4460
4461 Register null_value = rdi;
4462 __ LoadRoot(null_value, Heap::kNullValueRootIndex);
4463 __ cmpq(rax, null_value);
4464 DeoptimizeIf(equal, instr->environment());
4465
4466 Condition cc = masm()->CheckSmi(rax);
4467 DeoptimizeIf(cc, instr->environment());
4468
4469 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE);
4470 __ CmpObjectType(rax, LAST_JS_PROXY_TYPE, rcx);
4471 DeoptimizeIf(below_equal, instr->environment());
4472
4473 Label use_cache, call_runtime;
4474 __ CheckEnumCache(null_value, &call_runtime);
4475
4476 __ movq(rax, FieldOperand(rax, HeapObject::kMapOffset));
4477 __ jmp(&use_cache, Label::kNear);
4478
4479 // Get the set of properties to enumerate.
4480 __ bind(&call_runtime);
4481 __ push(rax);
4482 CallRuntime(Runtime::kGetPropertyNamesFast, 1, instr);
4483
4484 __ CompareRoot(FieldOperand(rax, HeapObject::kMapOffset),
4485 Heap::kMetaMapRootIndex);
4486 DeoptimizeIf(not_equal, instr->environment());
4487 __ bind(&use_cache);
4488 }
4489
4490
4491 void LCodeGen::DoForInCacheArray(LForInCacheArray* instr) {
4492 Register map = ToRegister(instr->map());
4493 Register result = ToRegister(instr->result());
4494 __ LoadInstanceDescriptors(map, result);
4495 __ movq(result,
4496 FieldOperand(result, DescriptorArray::kEnumerationIndexOffset));
4497 __ movq(result,
4498 FieldOperand(result, FixedArray::SizeFor(instr->idx())));
4499 Condition cc = masm()->CheckSmi(result);
4500 DeoptimizeIf(NegateCondition(cc), instr->environment());
4501 }
4502
4503
4504 void LCodeGen::DoCheckMapValue(LCheckMapValue* instr) {
4505 Register object = ToRegister(instr->value());
4506 __ cmpq(ToRegister(instr->map()),
4507 FieldOperand(object, HeapObject::kMapOffset));
4508 DeoptimizeIf(not_equal, instr->environment());
4509 }
4510
4511
4512 void LCodeGen::DoLoadFieldByIndex(LLoadFieldByIndex* instr) {
4513 Register object = ToRegister(instr->object());
4514 Register index = ToRegister(instr->index());
4515
4516 Label out_of_object, done;
4517 __ SmiToInteger32(index, index);
4518 __ cmpl(index, Immediate(0));
4519 __ j(less, &out_of_object);
4520 __ movq(object, FieldOperand(object,
4521 index,
4522 times_pointer_size,
4523 JSObject::kHeaderSize));
4524 __ jmp(&done, Label::kNear);
4525
4526 __ bind(&out_of_object);
4527 __ movq(object, FieldOperand(object, JSObject::kPropertiesOffset));
4528 __ negl(index);
4529 // Index is now equal to out of object property index plus 1.
4530 __ movq(object, FieldOperand(object,
4531 index,
4532 times_pointer_size,
4533 FixedArray::kHeaderSize - kPointerSize));
4534 __ bind(&done);
4535 }
4536
4537
4456 #undef __ 4538 #undef __
4457 4539
4458 } } // namespace v8::internal 4540 } } // namespace v8::internal
4459 4541
4460 #endif // V8_TARGET_ARCH_X64 4542 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698