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

Side by Side Diff: src/parser.cc

Issue 14721009: Track computed literal properties. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 7 years, 6 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 3978 matching lines...) Expand 10 before | Expand all | Expand 10 after
3989 if (m_literal != NULL && m_literal->depth() >= depth_acc) { 3989 if (m_literal != NULL && m_literal->depth() >= depth_acc) {
3990 depth_acc = m_literal->depth() + 1; 3990 depth_acc = m_literal->depth() + 1;
3991 } 3991 }
3992 3992
3993 // Add CONSTANT and COMPUTED properties to boilerplate. Use undefined 3993 // Add CONSTANT and COMPUTED properties to boilerplate. Use undefined
3994 // value for COMPUTED properties, the real value is filled in at 3994 // value for COMPUTED properties, the real value is filled in at
3995 // runtime. The enumeration order is maintained. 3995 // runtime. The enumeration order is maintained.
3996 Handle<Object> key = property->key()->handle(); 3996 Handle<Object> key = property->key()->handle();
3997 Handle<Object> value = GetBoilerplateValue(property->value()); 3997 Handle<Object> value = GetBoilerplateValue(property->value());
3998 3998
3999 // Ensure objects with doubles are always treated as nested objects. 3999 // Ensure objects that may, at any point in time, contain fields with double
4000 // representation are always treated as nested objects. This is true for
4001 // computed fields (value is undefined), and smi and double literals
4002 // (value->IsNumber()).
4000 // TODO(verwaest): Remove once we can store them inline. 4003 // TODO(verwaest): Remove once we can store them inline.
4001 if (FLAG_track_double_fields && value->IsNumber()) { 4004 if (FLAG_track_double_fields &&
4005 (value->IsNumber() || value->IsUndefined())) {
danno 2013/06/06 13:07:32 As discussed, super scary.
Toon Verwaest 2013/06/06 13:22:26 Done.
4002 *may_store_doubles = true; 4006 *may_store_doubles = true;
4003 } 4007 }
4004 4008
4005 is_simple_acc = is_simple_acc && !value->IsUndefined(); 4009 is_simple_acc = is_simple_acc && !value->IsUndefined();
4006 4010
4007 // Keep track of the number of elements in the object literal and 4011 // Keep track of the number of elements in the object literal and
4008 // the largest element index. If the largest element index is 4012 // the largest element index. If the largest element index is
4009 // much larger than the number of elements, creating an object 4013 // much larger than the number of elements, creating an object
4010 // literal with fast elements will be a waste of space. 4014 // literal with fast elements will be a waste of space.
4011 uint32_t element_index = 0; 4015 uint32_t element_index = 0;
(...skipping 2016 matching lines...) Expand 10 before | Expand all | Expand 10 after
6028 ASSERT(info()->isolate()->has_pending_exception()); 6032 ASSERT(info()->isolate()->has_pending_exception());
6029 } else { 6033 } else {
6030 result = ParseProgram(); 6034 result = ParseProgram();
6031 } 6035 }
6032 } 6036 }
6033 info()->SetFunction(result); 6037 info()->SetFunction(result);
6034 return (result != NULL); 6038 return (result != NULL);
6035 } 6039 }
6036 6040
6037 } } // namespace v8::internal 6041 } } // namespace v8::internal
OLDNEW
« src/objects.cc ('K') | « src/objects-inl.h ('k') | src/property.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698