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

Side by Side Diff: src/hydrogen.cc

Issue 9023006: Remove unnecessary environment from LStoreKeyedFastElements. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: removed one redundant smi-check Created 9 years 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/arm/lithium-codegen-arm.cc ('k') | src/hydrogen-instructions.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 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 3495 matching lines...) Expand 10 before | Expand all | Expand 10 after
3506 3506
3507 elements = new(zone()) HLoadElements(literal); 3507 elements = new(zone()) HLoadElements(literal);
3508 AddInstruction(elements); 3508 AddInstruction(elements);
3509 3509
3510 HValue* key = AddInstruction( 3510 HValue* key = AddInstruction(
3511 new(zone()) HConstant(Handle<Object>(Smi::FromInt(i)), 3511 new(zone()) HConstant(Handle<Object>(Smi::FromInt(i)),
3512 Representation::Integer32())); 3512 Representation::Integer32()));
3513 3513
3514 switch (boilerplate_elements_kind) { 3514 switch (boilerplate_elements_kind) {
3515 case FAST_SMI_ONLY_ELEMENTS: 3515 case FAST_SMI_ONLY_ELEMENTS:
3516 // Smi-only arrays need a smi check.
3517 AddInstruction(new(zone()) HCheckSmi(value));
3518 // Fall through.
3516 case FAST_ELEMENTS: 3519 case FAST_ELEMENTS:
3517 AddInstruction(new(zone()) HStoreKeyedFastElement( 3520 AddInstruction(new(zone()) HStoreKeyedFastElement(
3518 elements, 3521 elements,
3519 key, 3522 key,
3520 value, 3523 value,
3521 boilerplate_elements_kind)); 3524 boilerplate_elements_kind));
3522 break; 3525 break;
3523 case FAST_DOUBLE_ELEMENTS: 3526 case FAST_DOUBLE_ELEMENTS:
3524 AddInstruction(new(zone()) HStoreKeyedFastDoubleElement(elements, 3527 AddInstruction(new(zone()) HStoreKeyedFastDoubleElement(elements,
3525 key, 3528 key,
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
4216 } 4219 }
4217 4220
4218 4221
4219 HInstruction* HGraphBuilder::BuildFastElementAccess(HValue* elements, 4222 HInstruction* HGraphBuilder::BuildFastElementAccess(HValue* elements,
4220 HValue* checked_key, 4223 HValue* checked_key,
4221 HValue* val, 4224 HValue* val,
4222 ElementsKind elements_kind, 4225 ElementsKind elements_kind,
4223 bool is_store) { 4226 bool is_store) {
4224 if (is_store) { 4227 if (is_store) {
4225 ASSERT(val != NULL); 4228 ASSERT(val != NULL);
4226 if (elements_kind == FAST_DOUBLE_ELEMENTS) { 4229 switch (elements_kind) {
4227 return new(zone()) HStoreKeyedFastDoubleElement( 4230 case FAST_DOUBLE_ELEMENTS:
4228 elements, checked_key, val); 4231 return new(zone()) HStoreKeyedFastDoubleElement(
4229 } else { // FAST_ELEMENTS or FAST_SMI_ONLY_ELEMENTS. 4232 elements, checked_key, val);
4230 return new(zone()) HStoreKeyedFastElement( 4233 case FAST_SMI_ONLY_ELEMENTS:
4231 elements, checked_key, val, elements_kind); 4234 // Smi-only arrays need a smi check.
4235 AddInstruction(new(zone()) HCheckSmi(val));
4236 // Fall through.
4237 case FAST_ELEMENTS:
4238 return new(zone()) HStoreKeyedFastElement(
4239 elements, checked_key, val, elements_kind);
4240 default:
4241 UNREACHABLE();
4242 return NULL;
4232 } 4243 }
4233 } 4244 }
4234 // It's an element load (!is_store). 4245 // It's an element load (!is_store).
4235 if (elements_kind == FAST_DOUBLE_ELEMENTS) { 4246 if (elements_kind == FAST_DOUBLE_ELEMENTS) {
4236 return new(zone()) HLoadKeyedFastDoubleElement(elements, checked_key); 4247 return new(zone()) HLoadKeyedFastDoubleElement(elements, checked_key);
4237 } else { // FAST_ELEMENTS or FAST_SMI_ONLY_ELEMENTS. 4248 } else { // FAST_ELEMENTS or FAST_SMI_ONLY_ELEMENTS.
4238 return new(zone()) HLoadKeyedFastElement(elements, checked_key); 4249 return new(zone()) HLoadKeyedFastElement(elements, checked_key);
4239 } 4250 }
4240 } 4251 }
4241 4252
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
4392 elements_kind_instr, elements_kind, Token::EQ_STRICT); 4403 elements_kind_instr, elements_kind, Token::EQ_STRICT);
4393 elements_kind_branch->SetSuccessorAt(0, if_true); 4404 elements_kind_branch->SetSuccessorAt(0, if_true);
4394 elements_kind_branch->SetSuccessorAt(1, if_false); 4405 elements_kind_branch->SetSuccessorAt(1, if_false);
4395 current_block()->Finish(elements_kind_branch); 4406 current_block()->Finish(elements_kind_branch);
4396 4407
4397 set_current_block(if_true); 4408 set_current_block(if_true);
4398 HInstruction* access; 4409 HInstruction* access;
4399 if (elements_kind == FAST_SMI_ONLY_ELEMENTS || 4410 if (elements_kind == FAST_SMI_ONLY_ELEMENTS ||
4400 elements_kind == FAST_ELEMENTS || 4411 elements_kind == FAST_ELEMENTS ||
4401 elements_kind == FAST_DOUBLE_ELEMENTS) { 4412 elements_kind == FAST_DOUBLE_ELEMENTS) {
4402 if (is_store && elements_kind == FAST_SMI_ONLY_ELEMENTS) {
4403 AddInstruction(new(zone()) HCheckSmi(val));
fschneider 2011/12/22 16:00:03 This check becomes redundant because there is now
4404 }
4405 if (is_store && elements_kind != FAST_DOUBLE_ELEMENTS) { 4413 if (is_store && elements_kind != FAST_DOUBLE_ELEMENTS) {
4406 AddInstruction(new(zone()) HCheckMap( 4414 AddInstruction(new(zone()) HCheckMap(
4407 elements, isolate()->factory()->fixed_array_map(), 4415 elements, isolate()->factory()->fixed_array_map(),
4408 elements_kind_branch)); 4416 elements_kind_branch));
4409 } 4417 }
4410 // TODO(jkummerow): The need for these two blocks could be avoided 4418 // TODO(jkummerow): The need for these two blocks could be avoided
4411 // in one of two ways: 4419 // in one of two ways:
4412 // (1) Introduce ElementsKinds for JSArrays that are distinct from 4420 // (1) Introduce ElementsKinds for JSArrays that are distinct from
4413 // those for fast objects. 4421 // those for fast objects.
4414 // (2) Put the common instructions into a third "join" block. This 4422 // (2) Put the common instructions into a third "join" block. This
(...skipping 2888 matching lines...) Expand 10 before | Expand all | Expand 10 after
7303 } 7311 }
7304 } 7312 }
7305 7313
7306 #ifdef DEBUG 7314 #ifdef DEBUG
7307 if (graph_ != NULL) graph_->Verify(false); // No full verify. 7315 if (graph_ != NULL) graph_->Verify(false); // No full verify.
7308 if (allocator_ != NULL) allocator_->Verify(); 7316 if (allocator_ != NULL) allocator_->Verify();
7309 #endif 7317 #endif
7310 } 7318 }
7311 7319
7312 } } // namespace v8::internal 7320 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698