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

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

Issue 11108011: Ensure that we do not accidentally emit debug code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed indentation Created 8 years, 2 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/full-codegen-x64.cc ('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 1975 matching lines...) Expand 10 before | Expand all | Expand 10 after
1986 1986
1987 __ CmpObjectType(input, TestType(instr->hydrogen()), kScratchRegister); 1987 __ CmpObjectType(input, TestType(instr->hydrogen()), kScratchRegister);
1988 EmitBranch(true_block, false_block, BranchCondition(instr->hydrogen())); 1988 EmitBranch(true_block, false_block, BranchCondition(instr->hydrogen()));
1989 } 1989 }
1990 1990
1991 1991
1992 void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) { 1992 void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) {
1993 Register input = ToRegister(instr->value()); 1993 Register input = ToRegister(instr->value());
1994 Register result = ToRegister(instr->result()); 1994 Register result = ToRegister(instr->result());
1995 1995
1996 __ AbortIfNotString(input); 1996 __ AssertString(input);
1997 1997
1998 __ movl(result, FieldOperand(input, String::kHashFieldOffset)); 1998 __ movl(result, FieldOperand(input, String::kHashFieldOffset));
1999 ASSERT(String::kHashShift >= kSmiTagSize); 1999 ASSERT(String::kHashShift >= kSmiTagSize);
2000 __ IndexFromHash(result, result); 2000 __ IndexFromHash(result, result);
2001 } 2001 }
2002 2002
2003 2003
2004 void LCodeGen::DoHasCachedArrayIndexAndBranch( 2004 void LCodeGen::DoHasCachedArrayIndexAndBranch(
2005 LHasCachedArrayIndexAndBranch* instr) { 2005 LHasCachedArrayIndexAndBranch* instr) {
2006 Register input = ToRegister(instr->value()); 2006 Register input = ToRegister(instr->value());
(...skipping 1742 matching lines...) Expand 10 before | Expand all | Expand 10 after
3749 3749
3750 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { 3750 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
3751 DeoptIfTaggedButNotSmi(instr->environment(), 3751 DeoptIfTaggedButNotSmi(instr->environment(),
3752 instr->hydrogen()->length(), 3752 instr->hydrogen()->length(),
3753 instr->length()); 3753 instr->length());
3754 DeoptIfTaggedButNotSmi(instr->environment(), 3754 DeoptIfTaggedButNotSmi(instr->environment(),
3755 instr->hydrogen()->index(), 3755 instr->hydrogen()->index(),
3756 instr->index()); 3756 instr->index());
3757 if (instr->length()->IsRegister()) { 3757 if (instr->length()->IsRegister()) {
3758 Register reg = ToRegister(instr->length()); 3758 Register reg = ToRegister(instr->length());
3759 if (FLAG_debug_code && 3759 if (!instr->hydrogen()->length()->representation().IsTagged()) {
3760 !instr->hydrogen()->length()->representation().IsTagged()) { 3760 __ AssertZeroExtended(reg);
3761 __ AbortIfNotZeroExtended(reg);
3762 } 3761 }
3763 if (instr->index()->IsConstantOperand()) { 3762 if (instr->index()->IsConstantOperand()) {
3764 int constant_index = 3763 int constant_index =
3765 ToInteger32(LConstantOperand::cast(instr->index())); 3764 ToInteger32(LConstantOperand::cast(instr->index()));
3766 if (instr->hydrogen()->length()->representation().IsTagged()) { 3765 if (instr->hydrogen()->length()->representation().IsTagged()) {
3767 __ Cmp(reg, Smi::FromInt(constant_index)); 3766 __ Cmp(reg, Smi::FromInt(constant_index));
3768 } else { 3767 } else {
3769 __ cmpq(reg, Immediate(constant_index)); 3768 __ cmpq(reg, Immediate(constant_index));
3770 } 3769 }
3771 } else { 3770 } else {
3772 Register reg2 = ToRegister(instr->index()); 3771 Register reg2 = ToRegister(instr->index());
3773 if (FLAG_debug_code && 3772 if (!instr->hydrogen()->index()->representation().IsTagged()) {
3774 !instr->hydrogen()->index()->representation().IsTagged()) { 3773 __ AssertZeroExtended(reg2);
3775 __ AbortIfNotZeroExtended(reg2);
3776 } 3774 }
3777 __ cmpq(reg, reg2); 3775 __ cmpq(reg, reg2);
3778 } 3776 }
3779 } else { 3777 } else {
3780 Operand length = ToOperand(instr->length()); 3778 Operand length = ToOperand(instr->length());
3781 if (instr->index()->IsConstantOperand()) { 3779 if (instr->index()->IsConstantOperand()) {
3782 int constant_index = 3780 int constant_index =
3783 ToInteger32(LConstantOperand::cast(instr->index())); 3781 ToInteger32(LConstantOperand::cast(instr->index()));
3784 if (instr->hydrogen()->length()->representation().IsTagged()) { 3782 if (instr->hydrogen()->length()->representation().IsTagged()) {
3785 __ Cmp(length, Smi::FromInt(constant_index)); 3783 __ Cmp(length, Smi::FromInt(constant_index));
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
3984 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue); 3982 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue);
3985 if (instr->index()->IsConstantOperand()) { 3983 if (instr->index()->IsConstantOperand()) {
3986 int const_index = ToInteger32(LConstantOperand::cast(instr->index())); 3984 int const_index = ToInteger32(LConstantOperand::cast(instr->index()));
3987 __ Push(Smi::FromInt(const_index)); 3985 __ Push(Smi::FromInt(const_index));
3988 } else { 3986 } else {
3989 Register index = ToRegister(instr->index()); 3987 Register index = ToRegister(instr->index());
3990 __ Integer32ToSmi(index, index); 3988 __ Integer32ToSmi(index, index);
3991 __ push(index); 3989 __ push(index);
3992 } 3990 }
3993 CallRuntimeFromDeferred(Runtime::kStringCharCodeAt, 2, instr); 3991 CallRuntimeFromDeferred(Runtime::kStringCharCodeAt, 2, instr);
3994 if (FLAG_debug_code) { 3992 __ AssertSmi(rax);
3995 __ AbortIfNotSmi(rax);
3996 }
3997 __ SmiToInteger32(rax, rax); 3993 __ SmiToInteger32(rax, rax);
3998 __ StoreToSafepointRegisterSlot(result, rax); 3994 __ StoreToSafepointRegisterSlot(result, rax);
3999 } 3995 }
4000 3996
4001 3997
4002 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { 3998 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) {
4003 class DeferredStringCharFromCode: public LDeferredCode { 3999 class DeferredStringCharFromCode: public LDeferredCode {
4004 public: 4000 public:
4005 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr) 4001 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr)
4006 : LDeferredCode(codegen), instr_(instr) { } 4002 : LDeferredCode(codegen), instr_(instr) { }
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
4201 } 4197 }
4202 4198
4203 4199
4204 void LCodeGen::DoSmiUntag(LSmiUntag* instr) { 4200 void LCodeGen::DoSmiUntag(LSmiUntag* instr) {
4205 ASSERT(instr->value()->Equals(instr->result())); 4201 ASSERT(instr->value()->Equals(instr->result()));
4206 Register input = ToRegister(instr->value()); 4202 Register input = ToRegister(instr->value());
4207 if (instr->needs_check()) { 4203 if (instr->needs_check()) {
4208 Condition is_smi = __ CheckSmi(input); 4204 Condition is_smi = __ CheckSmi(input);
4209 DeoptimizeIf(NegateCondition(is_smi), instr->environment()); 4205 DeoptimizeIf(NegateCondition(is_smi), instr->environment());
4210 } else { 4206 } else {
4211 if (FLAG_debug_code) { 4207 __ AssertSmi(input);
4212 __ AbortIfNotSmi(input);
4213 }
4214 } 4208 }
4215 __ SmiToInteger32(input, input); 4209 __ SmiToInteger32(input, input);
4216 } 4210 }
4217 4211
4218 4212
4219 void LCodeGen::EmitNumberUntagD(Register input_reg, 4213 void LCodeGen::EmitNumberUntagD(Register input_reg,
4220 XMMRegister result_reg, 4214 XMMRegister result_reg,
4221 bool deoptimize_on_undefined, 4215 bool deoptimize_on_undefined,
4222 bool deoptimize_on_minus_zero, 4216 bool deoptimize_on_minus_zero,
4223 LEnvironment* env) { 4217 LEnvironment* env) {
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
4613 __ Abort("Allocated object is not in new-space"); 4607 __ Abort("Allocated object is not in new-space");
4614 __ bind(&is_in_new_space); 4608 __ bind(&is_in_new_space);
4615 } 4609 }
4616 4610
4617 // Load the initial map. 4611 // Load the initial map.
4618 Register map = scratch; 4612 Register map = scratch;
4619 __ LoadHeapObject(scratch, constructor); 4613 __ LoadHeapObject(scratch, constructor);
4620 __ movq(map, FieldOperand(scratch, JSFunction::kPrototypeOrInitialMapOffset)); 4614 __ movq(map, FieldOperand(scratch, JSFunction::kPrototypeOrInitialMapOffset));
4621 4615
4622 if (FLAG_debug_code) { 4616 if (FLAG_debug_code) {
4623 __ AbortIfSmi(map); 4617 __ AssertNotSmi(map);
4624 __ cmpb(FieldOperand(map, Map::kInstanceSizeOffset), 4618 __ cmpb(FieldOperand(map, Map::kInstanceSizeOffset),
4625 Immediate(instance_size >> kPointerSizeLog2)); 4619 Immediate(instance_size >> kPointerSizeLog2));
4626 __ Assert(equal, "Unexpected instance size"); 4620 __ Assert(equal, "Unexpected instance size");
4627 __ cmpb(FieldOperand(map, Map::kPreAllocatedPropertyFieldsOffset), 4621 __ cmpb(FieldOperand(map, Map::kPreAllocatedPropertyFieldsOffset),
4628 Immediate(initial_map->pre_allocated_property_fields())); 4622 Immediate(initial_map->pre_allocated_property_fields()));
4629 __ Assert(equal, "Unexpected pre-allocated property fields count"); 4623 __ Assert(equal, "Unexpected pre-allocated property fields count");
4630 __ cmpb(FieldOperand(map, Map::kUnusedPropertyFieldsOffset), 4624 __ cmpb(FieldOperand(map, Map::kUnusedPropertyFieldsOffset),
4631 Immediate(initial_map->unused_property_fields())); 4625 Immediate(initial_map->unused_property_fields()));
4632 __ Assert(equal, "Unexpected unused property fields count"); 4626 __ Assert(equal, "Unexpected unused property fields count");
4633 __ cmpb(FieldOperand(map, Map::kInObjectPropertiesOffset), 4627 __ cmpb(FieldOperand(map, Map::kInObjectPropertiesOffset),
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
5322 FixedArray::kHeaderSize - kPointerSize)); 5316 FixedArray::kHeaderSize - kPointerSize));
5323 __ bind(&done); 5317 __ bind(&done);
5324 } 5318 }
5325 5319
5326 5320
5327 #undef __ 5321 #undef __
5328 5322
5329 } } // namespace v8::internal 5323 } } // namespace v8::internal
5330 5324
5331 #endif // V8_TARGET_ARCH_X64 5325 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | src/x64/macro-assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698