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

Side by Side Diff: src/hydrogen.cc

Issue 8177005: Active smi-only optimizations for large array literals. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: review feedback Created 9 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/builtins.cc ('k') | src/ia32/full-codegen-ia32.cc » ('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 3328 matching lines...) Expand 10 before | Expand all | Expand 10 after
3339 3339
3340 // Load the elements array before the first store. 3340 // Load the elements array before the first store.
3341 if (elements == NULL) { 3341 if (elements == NULL) {
3342 elements = new(zone()) HLoadElements(literal); 3342 elements = new(zone()) HLoadElements(literal);
3343 AddInstruction(elements); 3343 AddInstruction(elements);
3344 } 3344 }
3345 3345
3346 HValue* key = AddInstruction( 3346 HValue* key = AddInstruction(
3347 new(zone()) HConstant(Handle<Object>(Smi::FromInt(i)), 3347 new(zone()) HConstant(Handle<Object>(Smi::FromInt(i)),
3348 Representation::Integer32())); 3348 Representation::Integer32()));
3349 if (FLAG_smi_only_arrays) { 3349 HInstruction* elements_kind =
3350 HInstruction* elements_kind = 3350 AddInstruction(new(zone()) HElementsKind(literal));
3351 AddInstruction(new(zone()) HElementsKind(literal)); 3351 HBasicBlock* store_fast = graph()->CreateBasicBlock();
3352 HBasicBlock* store_fast = graph()->CreateBasicBlock(); 3352 // Two empty blocks to satisfy edge split form.
3353 // Two empty blocks to satisfy edge split form. 3353 HBasicBlock* store_fast_edgesplit1 = graph()->CreateBasicBlock();
3354 HBasicBlock* store_fast_edgesplit1 = graph()->CreateBasicBlock(); 3354 HBasicBlock* store_fast_edgesplit2 = graph()->CreateBasicBlock();
3355 HBasicBlock* store_fast_edgesplit2 = graph()->CreateBasicBlock(); 3355 HBasicBlock* store_generic = graph()->CreateBasicBlock();
3356 HBasicBlock* store_generic = graph()->CreateBasicBlock(); 3356 HBasicBlock* check_smi_only_elements = graph()->CreateBasicBlock();
3357 HBasicBlock* check_smi_only_elements = graph()->CreateBasicBlock(); 3357 HBasicBlock* join = graph()->CreateBasicBlock();
3358 HBasicBlock* join = graph()->CreateBasicBlock();
3359 3358
3360 HIsSmiAndBranch* smicheck = new(zone()) HIsSmiAndBranch(value); 3359 HIsSmiAndBranch* smicheck = new(zone()) HIsSmiAndBranch(value);
3361 smicheck->SetSuccessorAt(0, store_fast_edgesplit1); 3360 smicheck->SetSuccessorAt(0, store_fast_edgesplit1);
3362 smicheck->SetSuccessorAt(1, check_smi_only_elements); 3361 smicheck->SetSuccessorAt(1, check_smi_only_elements);
3363 current_block()->Finish(smicheck); 3362 current_block()->Finish(smicheck);
3364 store_fast_edgesplit1->Finish(new(zone()) HGoto(store_fast)); 3363 store_fast_edgesplit1->Finish(new(zone()) HGoto(store_fast));
3365 3364
3366 set_current_block(check_smi_only_elements); 3365 set_current_block(check_smi_only_elements);
3367 HCompareConstantEqAndBranch* smi_elements_check = 3366 HCompareConstantEqAndBranch* smi_elements_check =
3368 new(zone()) HCompareConstantEqAndBranch(elements_kind, 3367 new(zone()) HCompareConstantEqAndBranch(elements_kind,
3369 FAST_SMI_ONLY_ELEMENTS, 3368 FAST_SMI_ONLY_ELEMENTS,
3370 Token::EQ_STRICT); 3369 Token::EQ_STRICT);
3371 smi_elements_check->SetSuccessorAt(0, store_generic); 3370 smi_elements_check->SetSuccessorAt(0, store_generic);
3372 smi_elements_check->SetSuccessorAt(1, store_fast_edgesplit2); 3371 smi_elements_check->SetSuccessorAt(1, store_fast_edgesplit2);
3373 current_block()->Finish(smi_elements_check); 3372 current_block()->Finish(smi_elements_check);
3374 store_fast_edgesplit2->Finish(new(zone()) HGoto(store_fast)); 3373 store_fast_edgesplit2->Finish(new(zone()) HGoto(store_fast));
3375 3374
3376 set_current_block(store_fast); 3375 set_current_block(store_fast);
3377 AddInstruction(new(zone()) HStoreKeyedFastElement(elements, key, value)); 3376 AddInstruction(new(zone()) HStoreKeyedFastElement(elements, key, value));
3378 store_fast->Goto(join); 3377 store_fast->Goto(join);
3379 3378
3380 set_current_block(store_generic); 3379 set_current_block(store_generic);
3381 AddInstruction(BuildStoreKeyedGeneric(literal, key, value)); 3380 AddInstruction(BuildStoreKeyedGeneric(literal, key, value));
3382 store_generic->Goto(join); 3381 store_generic->Goto(join);
3383 3382
3384 join->SetJoinId(expr->id()); 3383 join->SetJoinId(expr->id());
3385 set_current_block(join); 3384 set_current_block(join);
3386 } else {
3387 AddInstruction(new(zone()) HStoreKeyedFastElement(elements, key, value));
3388 }
3389 3385
3390 AddSimulate(expr->GetIdForElement(i)); 3386 AddSimulate(expr->GetIdForElement(i));
3391 } 3387 }
3392 return ast_context()->ReturnValue(Pop()); 3388 return ast_context()->ReturnValue(Pop());
3393 } 3389 }
3394 3390
3395 3391
3396 // Sets the lookup result and returns true if the store can be inlined. 3392 // Sets the lookup result and returns true if the store can be inlined.
3397 static bool ComputeStoredField(Handle<Map> type, 3393 static bool ComputeStoredField(Handle<Map> type,
3398 Handle<String> name, 3394 Handle<String> name,
(...skipping 3543 matching lines...) Expand 10 before | Expand all | Expand 10 after
6942 } 6938 }
6943 } 6939 }
6944 6940
6945 #ifdef DEBUG 6941 #ifdef DEBUG
6946 if (graph_ != NULL) graph_->Verify(false); // No full verify. 6942 if (graph_ != NULL) graph_->Verify(false); // No full verify.
6947 if (allocator_ != NULL) allocator_->Verify(); 6943 if (allocator_ != NULL) allocator_->Verify();
6948 #endif 6944 #endif
6949 } 6945 }
6950 6946
6951 } } // namespace v8::internal 6947 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/builtins.cc ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698