| 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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 set_depth(depth_acc); | 350 set_depth(depth_acc); |
| 351 } | 351 } |
| 352 | 352 |
| 353 | 353 |
| 354 void ArrayLiteral::BuildConstantElements(Isolate* isolate) { | 354 void ArrayLiteral::BuildConstantElements(Isolate* isolate) { |
| 355 if (!constant_elements_.is_null()) return; | 355 if (!constant_elements_.is_null()) return; |
| 356 | 356 |
| 357 // Allocate a fixed array to hold all the object literals. | 357 // Allocate a fixed array to hold all the object literals. |
| 358 Handle<JSArray> array = | 358 Handle<JSArray> array = |
| 359 isolate->factory()->NewJSArray(0, FAST_HOLEY_SMI_ELEMENTS); | 359 isolate->factory()->NewJSArray(0, FAST_HOLEY_SMI_ELEMENTS); |
| 360 isolate->factory()->SetElementsCapacityAndLength( | 360 JSArray::Expand(array, values()->length()); |
| 361 array, values()->length(), values()->length()); | |
| 362 | 361 |
| 363 // Fill in the literals. | 362 // Fill in the literals. |
| 364 bool is_simple = true; | 363 bool is_simple = true; |
| 365 int depth_acc = 1; | 364 int depth_acc = 1; |
| 366 bool is_holey = false; | 365 bool is_holey = false; |
| 367 for (int i = 0, n = values()->length(); i < n; i++) { | 366 for (int i = 0, n = values()->length(); i < n; i++) { |
| 368 Expression* element = values()->at(i); | 367 Expression* element = values()->at(i); |
| 369 MaterializedLiteral* m_literal = element->AsMaterializedLiteral(); | 368 MaterializedLiteral* m_literal = element->AsMaterializedLiteral(); |
| 370 if (m_literal != NULL) { | 369 if (m_literal != NULL) { |
| 371 m_literal->BuildConstants(isolate); | 370 m_literal->BuildConstants(isolate); |
| (...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1176 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); | 1175 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); |
| 1177 str = arr; | 1176 str = arr; |
| 1178 } else { | 1177 } else { |
| 1179 str = DoubleToCString(value_->Number(), buffer); | 1178 str = DoubleToCString(value_->Number(), buffer); |
| 1180 } | 1179 } |
| 1181 return isolate_->factory()->NewStringFromAscii(CStrVector(str)); | 1180 return isolate_->factory()->NewStringFromAscii(CStrVector(str)); |
| 1182 } | 1181 } |
| 1183 | 1182 |
| 1184 | 1183 |
| 1185 } } // namespace v8::internal | 1184 } } // namespace v8::internal |
| OLD | NEW |