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

Side by Side Diff: src/hydrogen.cc

Issue 24360019: Speed up ArrayBuffer/typed array/DataView properties. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: After self-review 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
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 4613 matching lines...) Expand 10 before | Expand all | Expand 10 after
4624 map->LookupDescriptor(*holder_, *name_, &lookup_); 4624 map->LookupDescriptor(*holder_, *name_, &lookup_);
4625 if (lookup_.IsFound()) return LoadResult(map); 4625 if (lookup_.IsFound()) return LoadResult(map);
4626 } 4626 }
4627 lookup_.NotFound(); 4627 lookup_.NotFound();
4628 return true; 4628 return true;
4629 } 4629 }
4630 4630
4631 4631
4632 bool HOptimizedGraphBuilder::PropertyAccessInfo::CanLoadMonomorphic() { 4632 bool HOptimizedGraphBuilder::PropertyAccessInfo::CanLoadMonomorphic() {
4633 if (!CanInlinePropertyAccess(*map_)) return IsStringLength(); 4633 if (!CanInlinePropertyAccess(*map_)) return IsStringLength();
4634 if (IsArrayLength()) return true; 4634 if (IsJSObjectFieldAccessor()) return true;
4635 if (!LookupDescriptor()) return false; 4635 if (!LookupDescriptor()) return false;
4636 if (lookup_.IsFound()) return true; 4636 if (lookup_.IsFound()) return true;
4637 return LookupInPrototypes(); 4637 return LookupInPrototypes();
4638 } 4638 }
4639 4639
4640 4640
4641 bool HOptimizedGraphBuilder::PropertyAccessInfo::CanLoadAsMonomorphic( 4641 bool HOptimizedGraphBuilder::PropertyAccessInfo::CanLoadAsMonomorphic(
4642 SmallMapList* types) { 4642 SmallMapList* types) {
4643 ASSERT(map_.is_identical_to(types->first())); 4643 ASSERT(map_.is_identical_to(types->first()));
4644 if (!CanLoadMonomorphic()) return false; 4644 if (!CanLoadMonomorphic()) return false;
(...skipping 11 matching lines...) Expand all
4656 for (int i = 1; i < types->length(); ++i) { 4656 for (int i = 1; i < types->length(); ++i) {
4657 Handle<Map> test_map = types->at(i); 4657 Handle<Map> test_map = types->at(i);
4658 if (test_map->instance_type() != JS_ARRAY_TYPE) return false; 4658 if (test_map->instance_type() != JS_ARRAY_TYPE) return false;
4659 if (IsFastElementsKind(test_map->elements_kind()) != is_fast) { 4659 if (IsFastElementsKind(test_map->elements_kind()) != is_fast) {
4660 return false; 4660 return false;
4661 } 4661 }
4662 } 4662 }
4663 return true; 4663 return true;
4664 } 4664 }
4665 4665
4666 if (IsTypedArrayLength()) { 4666 if (IsJSObjectFieldAccessor()) {
4667 InstanceType instance_type = map_->instance_type();
4667 for (int i = 1; i < types->length(); ++i) { 4668 for (int i = 1; i < types->length(); ++i) {
4668 if (types->at(i)->instance_type() != JS_TYPED_ARRAY_TYPE) return false; 4669 if (types->at(i)->instance_type() != instance_type) return false;
4669 } 4670 }
4670 return true; 4671 return true;
4671 } 4672 }
4672 4673
4673 for (int i = 1; i < types->length(); ++i) { 4674 for (int i = 1; i < types->length(); ++i) {
4674 PropertyAccessInfo test_info(isolate(), types->at(i), name_); 4675 PropertyAccessInfo test_info(isolate(), types->at(i), name_);
4675 if (!test_info.IsCompatibleForLoad(this)) return false; 4676 if (!test_info.IsCompatibleForLoad(this)) return false;
4676 } 4677 }
4677 4678
4678 return true; 4679 return true;
4679 } 4680 }
4680 4681
4681 4682
4682 HInstruction* HOptimizedGraphBuilder::BuildLoadMonomorphic( 4683 HInstruction* HOptimizedGraphBuilder::BuildLoadMonomorphic(
4683 PropertyAccessInfo* info, 4684 PropertyAccessInfo* info,
4684 HValue* object, 4685 HValue* object,
4685 HInstruction* checked_object, 4686 HInstruction* checked_object,
4686 BailoutId ast_id, 4687 BailoutId ast_id,
4687 BailoutId return_id, 4688 BailoutId return_id,
4688 bool can_inline_accessor) { 4689 bool can_inline_accessor) {
4689 if (info->IsStringLength()) {
4690 return New<HLoadNamedField>(
4691 checked_object, HObjectAccess::ForStringLength());
4692 }
4693 4690
4694 if (info->IsArrayLength()) { 4691 HObjectAccess access = HObjectAccess::ForMap(); // bogus default
4695 return New<HLoadNamedField>( 4692 if (info->GetJSObjectFieldAccess(&access)) {
4696 checked_object, HObjectAccess::ForArrayLength( 4693 return New<HLoadNamedField>(checked_object, access);
4697 info->map()->elements_kind()));
4698 }
4699
4700 if (info->IsTypedArrayLength()) {
4701 return New<HLoadNamedField>(
4702 checked_object, HObjectAccess::ForTypedArrayLength());
4703 } 4694 }
4704 4695
4705 HValue* checked_holder = checked_object; 4696 HValue* checked_holder = checked_object;
4706 if (info->has_holder()) { 4697 if (info->has_holder()) {
4707 Handle<JSObject> prototype(JSObject::cast(info->map()->prototype())); 4698 Handle<JSObject> prototype(JSObject::cast(info->map()->prototype()));
4708 checked_holder = BuildCheckPrototypeMaps(prototype, info->holder()); 4699 checked_holder = BuildCheckPrototypeMaps(prototype, info->holder());
4709 } 4700 }
4710 4701
4711 if (!info->lookup()->IsFound()) return graph()->GetConstantUndefined(); 4702 if (!info->lookup()->IsFound()) return graph()->GetConstantUndefined();
4712 4703
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
5395 Property* expr) { 5386 Property* expr) {
5396 if (expr->IsUninitialized()) { 5387 if (expr->IsUninitialized()) {
5397 Add<HDeoptimize>("Insufficient type feedback for generic named load", 5388 Add<HDeoptimize>("Insufficient type feedback for generic named load",
5398 Deoptimizer::SOFT); 5389 Deoptimizer::SOFT);
5399 } 5390 }
5400 HValue* context = environment()->context(); 5391 HValue* context = environment()->context();
5401 return new(zone()) HLoadNamedGeneric(context, object, name); 5392 return new(zone()) HLoadNamedGeneric(context, object, name);
5402 } 5393 }
5403 5394
5404 5395
5405 HInstruction* HOptimizedGraphBuilder::BuildCallGetter(
5406 HValue* object,
5407 Handle<Map> map,
5408 Handle<JSFunction> getter,
5409 Handle<JSObject> holder) {
5410 AddCheckConstantFunction(holder, object, map);
5411 Add<HPushArgument>(object);
5412 return new(zone()) HCallConstantFunction(getter, 1);
5413 }
5414
5415 5396
5416 HInstruction* HOptimizedGraphBuilder::BuildLoadKeyedGeneric(HValue* object, 5397 HInstruction* HOptimizedGraphBuilder::BuildLoadKeyedGeneric(HValue* object,
5417 HValue* key) { 5398 HValue* key) {
5418 HValue* context = environment()->context(); 5399 HValue* context = environment()->context();
5419 return new(zone()) HLoadKeyedGeneric(context, object, key); 5400 return new(zone()) HLoadKeyedGeneric(context, object, key);
5420 } 5401 }
5421 5402
5422 5403
5423 LoadKeyedHoleMode HOptimizedGraphBuilder::BuildKeyedHoleMode(Handle<Map> map) { 5404 LoadKeyedHoleMode HOptimizedGraphBuilder::BuildKeyedHoleMode(Handle<Map> map) {
5424 // Loads from a "stock" fast holey double arrays can elide the hole check. 5405 // Loads from a "stock" fast holey double arrays can elide the hole check.
(...skipping 4349 matching lines...) Expand 10 before | Expand all | Expand 10 after
9774 if (ShouldProduceTraceOutput()) { 9755 if (ShouldProduceTraceOutput()) {
9775 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 9756 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
9776 } 9757 }
9777 9758
9778 #ifdef DEBUG 9759 #ifdef DEBUG
9779 graph_->Verify(false); // No full verify. 9760 graph_->Verify(false); // No full verify.
9780 #endif 9761 #endif
9781 } 9762 }
9782 9763
9783 } } // namespace v8::internal 9764 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | src/ic.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698