OLD | NEW |
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 4309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4320 | 4320 |
4321 // Name is always in r2. | 4321 // Name is always in r2. |
4322 __ mov(r2, Operand(instr->name())); | 4322 __ mov(r2, Operand(instr->name())); |
4323 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) | 4323 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) |
4324 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 4324 ? isolate()->builtins()->StoreIC_Initialize_Strict() |
4325 : isolate()->builtins()->StoreIC_Initialize(); | 4325 : isolate()->builtins()->StoreIC_Initialize(); |
4326 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); | 4326 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); |
4327 } | 4327 } |
4328 | 4328 |
4329 | 4329 |
4330 void LCodeGen::DeoptIfTaggedButNotSmi(LEnvironment* environment, | |
4331 HValue* value, | |
4332 LOperand* operand) { | |
4333 if (value->representation().IsTagged() && !value->type().IsSmi()) { | |
4334 if (operand->IsRegister()) { | |
4335 __ tst(ToRegister(operand), Operand(kSmiTagMask)); | |
4336 } else { | |
4337 __ mov(ip, ToOperand(operand)); | |
4338 __ tst(ip, Operand(kSmiTagMask)); | |
4339 } | |
4340 DeoptimizeIf(ne, environment); | |
4341 } | |
4342 } | |
4343 | |
4344 | |
4345 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 4330 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
4346 DeoptIfTaggedButNotSmi(instr->environment(), | 4331 if (instr->hydrogen()->skip_check()) return; |
4347 instr->hydrogen()->length(), | 4332 |
4348 instr->length()); | |
4349 DeoptIfTaggedButNotSmi(instr->environment(), | |
4350 instr->hydrogen()->index(), | |
4351 instr->index()); | |
4352 if (instr->index()->IsConstantOperand()) { | 4333 if (instr->index()->IsConstantOperand()) { |
4353 int constant_index = | 4334 int constant_index = |
4354 ToInteger32(LConstantOperand::cast(instr->index())); | 4335 ToInteger32(LConstantOperand::cast(instr->index())); |
4355 if (instr->hydrogen()->length()->representation().IsTagged()) { | 4336 if (instr->hydrogen()->length()->representation().IsTagged()) { |
4356 __ mov(ip, Operand(Smi::FromInt(constant_index))); | 4337 __ mov(ip, Operand(Smi::FromInt(constant_index))); |
4357 } else { | 4338 } else { |
4358 __ mov(ip, Operand(constant_index)); | 4339 __ mov(ip, Operand(constant_index)); |
4359 } | 4340 } |
4360 __ cmp(ip, ToRegister(instr->length())); | 4341 __ cmp(ip, ToRegister(instr->length())); |
4361 } else { | 4342 } else { |
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5311 } | 5292 } |
5312 | 5293 |
5313 | 5294 |
5314 void LCodeGen::DoCheckSmi(LCheckSmi* instr) { | 5295 void LCodeGen::DoCheckSmi(LCheckSmi* instr) { |
5315 LOperand* input = instr->value(); | 5296 LOperand* input = instr->value(); |
5316 __ tst(ToRegister(input), Operand(kSmiTagMask)); | 5297 __ tst(ToRegister(input), Operand(kSmiTagMask)); |
5317 DeoptimizeIf(ne, instr->environment()); | 5298 DeoptimizeIf(ne, instr->environment()); |
5318 } | 5299 } |
5319 | 5300 |
5320 | 5301 |
| 5302 void LCodeGen::DoDeoptimizeIfTaggedIsNotSmi( |
| 5303 LDeoptimizeIfTaggedIsNotSmi* instr) { |
| 5304 if (instr->hydrogen_value()->representation().IsTagged() && |
| 5305 !instr->hydrogen_value()->type().IsSmi()) { |
| 5306 LOperand* operand = instr->value(); |
| 5307 if (operand->IsRegister()) { |
| 5308 __ tst(ToRegister(operand), Operand(kSmiTagMask)); |
| 5309 } else { |
| 5310 __ mov(ip, ToOperand(operand)); |
| 5311 __ tst(ip, Operand(kSmiTagMask)); |
| 5312 } |
| 5313 DeoptimizeIf(ne, instr->environment()); |
| 5314 } |
| 5315 } |
| 5316 |
| 5317 |
5321 void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) { | 5318 void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) { |
5322 LOperand* input = instr->value(); | 5319 LOperand* input = instr->value(); |
5323 __ tst(ToRegister(input), Operand(kSmiTagMask)); | 5320 __ tst(ToRegister(input), Operand(kSmiTagMask)); |
5324 DeoptimizeIf(eq, instr->environment()); | 5321 DeoptimizeIf(eq, instr->environment()); |
5325 } | 5322 } |
5326 | 5323 |
5327 | 5324 |
5328 void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) { | 5325 void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) { |
5329 Register input = ToRegister(instr->value()); | 5326 Register input = ToRegister(instr->value()); |
5330 Register scratch = scratch0(); | 5327 Register scratch = scratch0(); |
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6316 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); | 6313 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); |
6317 __ ldr(result, FieldMemOperand(scratch, | 6314 __ ldr(result, FieldMemOperand(scratch, |
6318 FixedArray::kHeaderSize - kPointerSize)); | 6315 FixedArray::kHeaderSize - kPointerSize)); |
6319 __ bind(&done); | 6316 __ bind(&done); |
6320 } | 6317 } |
6321 | 6318 |
6322 | 6319 |
6323 #undef __ | 6320 #undef __ |
6324 | 6321 |
6325 } } // namespace v8::internal | 6322 } } // namespace v8::internal |
OLD | NEW |