OLD | NEW |
---|---|
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 3996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4007 MaterializedLiteral* m_literal = property->value()->AsMaterializedLiteral(); | 4007 MaterializedLiteral* m_literal = property->value()->AsMaterializedLiteral(); |
4008 if (m_literal != NULL && m_literal->depth() >= depth_acc) { | 4008 if (m_literal != NULL && m_literal->depth() >= depth_acc) { |
4009 depth_acc = m_literal->depth() + 1; | 4009 depth_acc = m_literal->depth() + 1; |
4010 } | 4010 } |
4011 | 4011 |
4012 // Add CONSTANT and COMPUTED properties to boilerplate. Use undefined | 4012 // Add CONSTANT and COMPUTED properties to boilerplate. Use undefined |
4013 // value for COMPUTED properties, the real value is filled in at | 4013 // value for COMPUTED properties, the real value is filled in at |
4014 // runtime. The enumeration order is maintained. | 4014 // runtime. The enumeration order is maintained. |
4015 Handle<Object> key = property->key()->handle(); | 4015 Handle<Object> key = property->key()->handle(); |
4016 Handle<Object> value = GetBoilerplateValue(property->value()); | 4016 Handle<Object> value = GetBoilerplateValue(property->value()); |
4017 | |
4018 // Ensure objects with doubles are always treated as nested objects. | |
4019 // TODO(verwaest): Remove once we can store them inline. | |
4020 if (FLAG_track_fields && value->IsNumber()) { | |
4021 depth_acc = Max(2, depth_acc); | |
4022 } | |
danno
2013/05/07 13:04:47
*COUGH* Any other better way to do this? *COUGH*
B
Toon Verwaest
2013/05/07 15:08:52
Done.
| |
4017 is_simple_acc = is_simple_acc && !value->IsUndefined(); | 4023 is_simple_acc = is_simple_acc && !value->IsUndefined(); |
4018 | 4024 |
4019 // Keep track of the number of elements in the object literal and | 4025 // Keep track of the number of elements in the object literal and |
4020 // the largest element index. If the largest element index is | 4026 // the largest element index. If the largest element index is |
4021 // much larger than the number of elements, creating an object | 4027 // much larger than the number of elements, creating an object |
4022 // literal with fast elements will be a waste of space. | 4028 // literal with fast elements will be a waste of space. |
4023 uint32_t element_index = 0; | 4029 uint32_t element_index = 0; |
4024 if (key->IsString() | 4030 if (key->IsString() |
4025 && Handle<String>::cast(key)->AsArrayIndex(&element_index) | 4031 && Handle<String>::cast(key)->AsArrayIndex(&element_index) |
4026 && element_index > max_element_index) { | 4032 && element_index > max_element_index) { |
(...skipping 2009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6036 ASSERT(info()->isolate()->has_pending_exception()); | 6042 ASSERT(info()->isolate()->has_pending_exception()); |
6037 } else { | 6043 } else { |
6038 result = ParseProgram(); | 6044 result = ParseProgram(); |
6039 } | 6045 } |
6040 } | 6046 } |
6041 info()->SetFunction(result); | 6047 info()->SetFunction(result); |
6042 return (result != NULL); | 6048 return (result != NULL); |
6043 } | 6049 } |
6044 | 6050 |
6045 } } // namespace v8::internal | 6051 } } // namespace v8::internal |
OLD | NEW |