| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_FACTORY_H_ | 5 #ifndef V8_FACTORY_H_ |
| 6 #define V8_FACTORY_H_ | 6 #define V8_FACTORY_H_ |
| 7 | 7 |
| 8 #include "isolate.h" | 8 #include "isolate.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 int new_length, | 275 int new_length, |
| 276 PretenureFlag pretenure = NOT_TENURED); | 276 PretenureFlag pretenure = NOT_TENURED); |
| 277 | 277 |
| 278 Handle<FixedDoubleArray> CopyFixedDoubleArray( | 278 Handle<FixedDoubleArray> CopyFixedDoubleArray( |
| 279 Handle<FixedDoubleArray> array); | 279 Handle<FixedDoubleArray> array); |
| 280 | 280 |
| 281 Handle<ConstantPoolArray> CopyConstantPoolArray( | 281 Handle<ConstantPoolArray> CopyConstantPoolArray( |
| 282 Handle<ConstantPoolArray> array); | 282 Handle<ConstantPoolArray> array); |
| 283 | 283 |
| 284 // Numbers (e.g. literals) are pretenured by the parser. | 284 // Numbers (e.g. literals) are pretenured by the parser. |
| 285 // The return value may be a smi or a heap number. |
| 285 Handle<Object> NewNumber(double value, | 286 Handle<Object> NewNumber(double value, |
| 286 PretenureFlag pretenure = NOT_TENURED); | 287 PretenureFlag pretenure = NOT_TENURED); |
| 287 | 288 |
| 288 Handle<Object> NewNumberFromInt(int32_t value, | 289 Handle<Object> NewNumberFromInt(int32_t value, |
| 289 PretenureFlag pretenure = NOT_TENURED); | 290 PretenureFlag pretenure = NOT_TENURED); |
| 290 Handle<Object> NewNumberFromUint(uint32_t value, | 291 Handle<Object> NewNumberFromUint(uint32_t value, |
| 291 PretenureFlag pretenure = NOT_TENURED); | 292 PretenureFlag pretenure = NOT_TENURED); |
| 292 Handle<Object> NewNumberFromSize(size_t value, | 293 Handle<Object> NewNumberFromSize(size_t value, |
| 293 PretenureFlag pretenure = NOT_TENURED) { | 294 PretenureFlag pretenure = NOT_TENURED) { |
| 294 if (Smi::IsValid(static_cast<intptr_t>(value))) { | 295 if (Smi::IsValid(static_cast<intptr_t>(value))) { |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 Handle<Object> NewReferenceError(const char* message, | 491 Handle<Object> NewReferenceError(const char* message, |
| 491 Vector< Handle<Object> > args); | 492 Vector< Handle<Object> > args); |
| 492 Handle<Object> NewReferenceError(const char* message, Handle<JSArray> args); | 493 Handle<Object> NewReferenceError(const char* message, Handle<JSArray> args); |
| 493 Handle<Object> NewReferenceError(Handle<String> message); | 494 Handle<Object> NewReferenceError(Handle<String> message); |
| 494 | 495 |
| 495 Handle<Object> NewEvalError(const char* message, | 496 Handle<Object> NewEvalError(const char* message, |
| 496 Vector< Handle<Object> > args); | 497 Vector< Handle<Object> > args); |
| 497 | 498 |
| 498 Handle<String> NumberToString(Handle<Object> number, | 499 Handle<String> NumberToString(Handle<Object> number, |
| 499 bool check_number_string_cache = true); | 500 bool check_number_string_cache = true); |
| 500 Handle<String> Uint32ToString(uint32_t value); | 501 |
| 502 Handle<String> Uint32ToString(uint32_t value) { |
| 503 return NumberToString(NewNumberFromUint(value)); |
| 504 } |
| 501 | 505 |
| 502 enum ApiInstanceType { | 506 enum ApiInstanceType { |
| 503 JavaScriptObject, | 507 JavaScriptObject, |
| 504 InnerGlobalObject, | 508 InnerGlobalObject, |
| 505 OuterGlobalObject | 509 OuterGlobalObject |
| 506 }; | 510 }; |
| 507 | 511 |
| 508 Handle<JSFunction> CreateApiFunction( | 512 Handle<JSFunction> CreateApiFunction( |
| 509 Handle<FunctionTemplateInfo> data, | 513 Handle<FunctionTemplateInfo> data, |
| 510 ApiInstanceType type = JavaScriptObject); | 514 ApiInstanceType type = JavaScriptObject); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 Handle<Object> prototype, | 637 Handle<Object> prototype, |
| 634 PretenureFlag pretenure = TENURED); | 638 PretenureFlag pretenure = TENURED); |
| 635 | 639 |
| 636 // Create a new map cache. | 640 // Create a new map cache. |
| 637 Handle<MapCache> NewMapCache(int at_least_space_for); | 641 Handle<MapCache> NewMapCache(int at_least_space_for); |
| 638 | 642 |
| 639 // Update the map cache in the native context with (keys, map) | 643 // Update the map cache in the native context with (keys, map) |
| 640 Handle<MapCache> AddToMapCache(Handle<Context> context, | 644 Handle<MapCache> AddToMapCache(Handle<Context> context, |
| 641 Handle<FixedArray> keys, | 645 Handle<FixedArray> keys, |
| 642 Handle<Map> map); | 646 Handle<Map> map); |
| 647 |
| 648 // Attempt to find the number in a small cache. If we finds it, return |
| 649 // the string representation of the number. Otherwise return undefined. |
| 650 Handle<Object> GetNumberStringCache(Handle<Object> number); |
| 651 |
| 652 // Update the cache with a new number-string pair. |
| 653 void SetNumberStringCache(Handle<Object> number, Handle<String> string); |
| 643 }; | 654 }; |
| 644 | 655 |
| 645 } } // namespace v8::internal | 656 } } // namespace v8::internal |
| 646 | 657 |
| 647 #endif // V8_FACTORY_H_ | 658 #endif // V8_FACTORY_H_ |
| OLD | NEW |