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

Side by Side Diff: src/hydrogen.cc

Issue 23484060: Optimize typed-array length loading. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix bug Created 7 years, 3 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/hydrogen.h ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 4612 matching lines...) Expand 10 before | Expand all | Expand 10 after
4623 for (int i = 1; i < types->length(); ++i) { 4623 for (int i = 1; i < types->length(); ++i) {
4624 Handle<Map> test_map = types->at(i); 4624 Handle<Map> test_map = types->at(i);
4625 if (test_map->instance_type() != JS_ARRAY_TYPE) return false; 4625 if (test_map->instance_type() != JS_ARRAY_TYPE) return false;
4626 if (IsFastElementsKind(test_map->elements_kind()) != is_fast) { 4626 if (IsFastElementsKind(test_map->elements_kind()) != is_fast) {
4627 return false; 4627 return false;
4628 } 4628 }
4629 } 4629 }
4630 return true; 4630 return true;
4631 } 4631 }
4632 4632
4633 if (IsTypedArrayLength()) {
4634 for (int i = 1; i < types->length(); ++i) {
4635 if (types->at(i)->instance_type() != JS_TYPED_ARRAY_TYPE) return false;
4636 }
4637 return true;
4638 }
4639
4633 for (int i = 1; i < types->length(); ++i) { 4640 for (int i = 1; i < types->length(); ++i) {
4634 PropertyAccessInfo test_info(isolate(), types->at(i), name_); 4641 PropertyAccessInfo test_info(isolate(), types->at(i), name_);
4635 if (!test_info.IsCompatibleForLoad(this)) return false; 4642 if (!test_info.IsCompatibleForLoad(this)) return false;
4636 } 4643 }
4637 4644
4638 return true; 4645 return true;
4639 } 4646 }
4640 4647
4641 4648
4642 HInstruction* HOptimizedGraphBuilder::BuildLoadMonomorphic( 4649 HInstruction* HOptimizedGraphBuilder::BuildLoadMonomorphic(
4643 PropertyAccessInfo* info, 4650 PropertyAccessInfo* info,
4644 HValue* object, 4651 HValue* object,
4645 HInstruction* checked_object, 4652 HInstruction* checked_object,
4646 BailoutId ast_id, 4653 BailoutId ast_id,
4647 BailoutId return_id, 4654 BailoutId return_id,
4648 bool can_inline_accessor) { 4655 bool can_inline_accessor) {
4649 if (info->IsStringLength()) { 4656 if (info->IsStringLength()) {
4650 return New<HLoadNamedField>( 4657 return New<HLoadNamedField>(
4651 checked_object, HObjectAccess::ForStringLength()); 4658 checked_object, HObjectAccess::ForStringLength());
4652 } 4659 }
4653 4660
4654 if (info->IsArrayLength()) { 4661 if (info->IsArrayLength()) {
4655 return New<HLoadNamedField>( 4662 return New<HLoadNamedField>(
4656 checked_object, HObjectAccess::ForArrayLength( 4663 checked_object, HObjectAccess::ForArrayLength(
4657 info->map()->elements_kind())); 4664 info->map()->elements_kind()));
4658 } 4665 }
4659 4666
4667 if (info->IsTypedArrayLength()) {
4668 return New<HLoadNamedField>(
4669 checked_object, HObjectAccess::ForTypedArrayLength());
4670 }
4671
4660 HValue* checked_holder = checked_object; 4672 HValue* checked_holder = checked_object;
4661 if (info->has_holder()) { 4673 if (info->has_holder()) {
4662 Handle<JSObject> prototype(JSObject::cast(info->map()->prototype())); 4674 Handle<JSObject> prototype(JSObject::cast(info->map()->prototype()));
4663 checked_holder = BuildCheckPrototypeMaps(prototype, info->holder()); 4675 checked_holder = BuildCheckPrototypeMaps(prototype, info->holder());
4664 } 4676 }
4665 4677
4666 if (!info->lookup()->IsFound()) return graph()->GetConstantUndefined(); 4678 if (!info->lookup()->IsFound()) return graph()->GetConstantUndefined();
4667 4679
4668 if (info->lookup()->IsField()) { 4680 if (info->lookup()->IsField()) {
4669 return BuildLoadNamedField(checked_holder, info->access()); 4681 return BuildLoadNamedField(checked_holder, info->access());
(...skipping 4951 matching lines...) Expand 10 before | Expand all | Expand 10 after
9621 if (ShouldProduceTraceOutput()) { 9633 if (ShouldProduceTraceOutput()) {
9622 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 9634 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
9623 } 9635 }
9624 9636
9625 #ifdef DEBUG 9637 #ifdef DEBUG
9626 graph_->Verify(false); // No full verify. 9638 graph_->Verify(false); // No full verify.
9627 #endif 9639 #endif
9628 } 9640 }
9629 9641
9630 } } // namespace v8::internal 9642 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698