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

Side by Side Diff: src/hydrogen.cc

Issue 9814006: First implementation of fast path for instantiation of array literals composed of doubles. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed core review comments. Created 8 years, 9 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 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 3657 matching lines...) Expand 10 before | Expand all | Expand 10 after
3668 static bool IsFastLiteral(Handle<JSObject> boilerplate, 3668 static bool IsFastLiteral(Handle<JSObject> boilerplate,
3669 int max_depth, 3669 int max_depth,
3670 int* max_properties, 3670 int* max_properties,
3671 int* total_size) { 3671 int* total_size) {
3672 ASSERT(max_depth >= 0 && *max_properties >= 0); 3672 ASSERT(max_depth >= 0 && *max_properties >= 0);
3673 if (max_depth == 0) return false; 3673 if (max_depth == 0) return false;
3674 3674
3675 Handle<FixedArrayBase> elements(boilerplate->elements()); 3675 Handle<FixedArrayBase> elements(boilerplate->elements());
3676 if (elements->length() > 0 && 3676 if (elements->length() > 0 &&
3677 elements->map() != boilerplate->GetHeap()->fixed_cow_array_map()) { 3677 elements->map() != boilerplate->GetHeap()->fixed_cow_array_map()) {
3678 if (!boilerplate->HasFastElements()) return false; 3678 if (boilerplate->HasFastDoubleElements()) {
3679 int length = elements->length(); 3679 *total_size += FixedDoubleArray::SizeFor(elements->length());
3680 for (int i = 0; i < length; i++) { 3680 } else if (boilerplate->HasFastElements()) {
3681 if ((*max_properties)-- == 0) return false; 3681 int length = elements->length();
3682 Handle<Object> value = JSObject::GetElement(boilerplate, i); 3682 for (int i = 0; i < length; i++) {
3683 if (value->IsJSObject()) { 3683 if ((*max_properties)-- == 0) return false;
3684 Handle<JSObject> value_object = Handle<JSObject>::cast(value); 3684 Handle<Object> value = JSObject::GetElement(boilerplate, i);
3685 if (!IsFastLiteral(value_object, 3685 if (value->IsJSObject()) {
3686 max_depth - 1, 3686 Handle<JSObject> value_object = Handle<JSObject>::cast(value);
3687 max_properties, 3687 if (!IsFastLiteral(value_object,
3688 total_size)) { 3688 max_depth - 1,
3689 return false; 3689 max_properties,
3690 total_size)) {
3691 return false;
3692 }
3690 } 3693 }
3691 } 3694 }
3695 *total_size += FixedArray::SizeFor(length);
3696 } else {
3697 return false;
3692 } 3698 }
3693 *total_size += FixedArray::SizeFor(length);
3694 } 3699 }
3695 3700
3696 Handle<FixedArray> properties(boilerplate->properties()); 3701 Handle<FixedArray> properties(boilerplate->properties());
3697 if (properties->length() > 0) { 3702 if (properties->length() > 0) {
3698 return false; 3703 return false;
3699 } else { 3704 } else {
3700 int nof = boilerplate->map()->inobject_properties(); 3705 int nof = boilerplate->map()->inobject_properties();
3701 for (int i = 0; i < nof; i++) { 3706 for (int i = 0; i < nof; i++) {
3702 if ((*max_properties)-- == 0) return false; 3707 if ((*max_properties)-- == 0) return false;
3703 Handle<Object> value(boilerplate->InObjectPropertyAt(i)); 3708 Handle<Object> value(boilerplate->InObjectPropertyAt(i));
(...skipping 4452 matching lines...) Expand 10 before | Expand all | Expand 10 after
8156 } 8161 }
8157 } 8162 }
8158 8163
8159 #ifdef DEBUG 8164 #ifdef DEBUG
8160 if (graph_ != NULL) graph_->Verify(false); // No full verify. 8165 if (graph_ != NULL) graph_->Verify(false); // No full verify.
8161 if (allocator_ != NULL) allocator_->Verify(); 8166 if (allocator_ != NULL) allocator_->Verify();
8162 #endif 8167 #endif
8163 } 8168 }
8164 8169
8165 } } // namespace v8::internal 8170 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698