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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 Handle<FixedDoubleArray> array); | 259 Handle<FixedDoubleArray> array); |
260 | 260 |
261 // Numbers (e.g. literals) are pretenured by the parser. | 261 // Numbers (e.g. literals) are pretenured by the parser. |
262 Handle<Object> NewNumber(double value, | 262 Handle<Object> NewNumber(double value, |
263 PretenureFlag pretenure = NOT_TENURED); | 263 PretenureFlag pretenure = NOT_TENURED); |
264 | 264 |
265 Handle<Object> NewNumberFromInt(int32_t value, | 265 Handle<Object> NewNumberFromInt(int32_t value, |
266 PretenureFlag pretenure = NOT_TENURED); | 266 PretenureFlag pretenure = NOT_TENURED); |
267 Handle<Object> NewNumberFromUint(uint32_t value, | 267 Handle<Object> NewNumberFromUint(uint32_t value, |
268 PretenureFlag pretenure = NOT_TENURED); | 268 PretenureFlag pretenure = NOT_TENURED); |
269 | 269 inline Handle<Object> NewNumberFromSize(size_t value, |
| 270 PretenureFlag pretenure = NOT_TENURED); |
270 Handle<HeapNumber> NewHeapNumber(double value, | 271 Handle<HeapNumber> NewHeapNumber(double value, |
271 PretenureFlag pretenure = NOT_TENURED); | 272 PretenureFlag pretenure = NOT_TENURED); |
272 | 273 |
| 274 |
273 // These objects are used by the api to create env-independent data | 275 // These objects are used by the api to create env-independent data |
274 // structures in the heap. | 276 // structures in the heap. |
275 Handle<JSObject> NewNeanderObject(); | 277 Handle<JSObject> NewNeanderObject(); |
276 | 278 |
277 Handle<JSObject> NewArgumentsObject(Handle<Object> callee, int length); | 279 Handle<JSObject> NewArgumentsObject(Handle<Object> callee, int length); |
278 | 280 |
279 // JS objects are pretenured when allocated by the bootstrapper and | 281 // JS objects are pretenured when allocated by the bootstrapper and |
280 // runtime. | 282 // runtime. |
281 Handle<JSObject> NewJSObject(Handle<JSFunction> constructor, | 283 Handle<JSObject> NewJSObject(Handle<JSFunction> constructor, |
282 PretenureFlag pretenure = NOT_TENURED); | 284 PretenureFlag pretenure = NOT_TENURED); |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 // Create a new map cache. | 534 // Create a new map cache. |
533 Handle<MapCache> NewMapCache(int at_least_space_for); | 535 Handle<MapCache> NewMapCache(int at_least_space_for); |
534 | 536 |
535 // Update the map cache in the native context with (keys, map) | 537 // Update the map cache in the native context with (keys, map) |
536 Handle<MapCache> AddToMapCache(Handle<Context> context, | 538 Handle<MapCache> AddToMapCache(Handle<Context> context, |
537 Handle<FixedArray> keys, | 539 Handle<FixedArray> keys, |
538 Handle<Map> map); | 540 Handle<Map> map); |
539 }; | 541 }; |
540 | 542 |
541 | 543 |
| 544 Handle<Object> Factory::NewNumberFromSize(size_t value, |
| 545 PretenureFlag pretenure) { |
| 546 if (Smi::IsValid(static_cast<intptr_t>(value))) { |
| 547 return Handle<Object>(Smi::FromIntptr(static_cast<intptr_t>(value)), |
| 548 isolate()); |
| 549 } else { |
| 550 return NewNumber(static_cast<double>(value), pretenure); |
| 551 } |
| 552 } |
| 553 |
| 554 |
| 555 |
542 } } // namespace v8::internal | 556 } } // namespace v8::internal |
543 | 557 |
544 #endif // V8_FACTORY_H_ | 558 #endif // V8_FACTORY_H_ |
OLD | NEW |