| 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 Handle<String> NewSubString(Handle<String> str, int begin, int end) { | 164 Handle<String> NewSubString(Handle<String> str, int begin, int end) { |
| 165 if (begin == 0 && end == str->length()) return str; | 165 if (begin == 0 && end == str->length()) return str; |
| 166 return NewProperSubString(str, begin, end); | 166 return NewProperSubString(str, begin, end); |
| 167 } | 167 } |
| 168 | 168 |
| 169 Handle<SlicedString> NewRawSlicedString(String::Encoding encoding); | 169 Handle<SlicedString> NewRawSlicedString(String::Encoding encoding); |
| 170 | 170 |
| 171 // Creates a new external String object. There are two String encodings | 171 // Creates a new external String object. There are two String encodings |
| 172 // in the system: ASCII and two byte. Unlike other String types, it does | 172 // in the system: ASCII and two byte. Unlike other String types, it does |
| 173 // not make sense to have a UTF-8 factory function for external strings, | 173 // not make sense to have a UTF-8 factory function for external strings, |
| 174 // because we cannot change the underlying buffer. | 174 // because we cannot change the underlying buffer. Note that these strings |
| 175 // are backed by a string resource that resides outside the V8 heap. |
| 175 MUST_USE_RESULT MaybeHandle<String> NewExternalStringFromAscii( | 176 MUST_USE_RESULT MaybeHandle<String> NewExternalStringFromAscii( |
| 176 const ExternalAsciiString::Resource* resource); | 177 const ExternalAsciiString::Resource* resource); |
| 177 MUST_USE_RESULT MaybeHandle<String> NewExternalStringFromTwoByte( | 178 MUST_USE_RESULT MaybeHandle<String> NewExternalStringFromTwoByte( |
| 178 const ExternalTwoByteString::Resource* resource); | 179 const ExternalTwoByteString::Resource* resource); |
| 179 | 180 |
| 180 // Create a symbol. | 181 // Create a symbol. |
| 181 Handle<Symbol> NewSymbol(); | 182 Handle<Symbol> NewSymbol(); |
| 182 Handle<Symbol> NewPrivateSymbol(); | 183 Handle<Symbol> NewPrivateSymbol(); |
| 183 | 184 |
| 184 // Create a global (but otherwise uninitialized) context. | 185 // Create a global (but otherwise uninitialized) context. |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS); | 380 ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS); |
| 380 | 381 |
| 381 Handle<JSGeneratorObject> NewJSGeneratorObject(Handle<JSFunction> function); | 382 Handle<JSGeneratorObject> NewJSGeneratorObject(Handle<JSFunction> function); |
| 382 | 383 |
| 383 Handle<JSArrayBuffer> NewJSArrayBuffer(); | 384 Handle<JSArrayBuffer> NewJSArrayBuffer(); |
| 384 | 385 |
| 385 Handle<JSTypedArray> NewJSTypedArray(ExternalArrayType type); | 386 Handle<JSTypedArray> NewJSTypedArray(ExternalArrayType type); |
| 386 | 387 |
| 387 Handle<JSDataView> NewJSDataView(); | 388 Handle<JSDataView> NewJSDataView(); |
| 388 | 389 |
| 390 // Allocates a Harmony proxy. |
| 389 Handle<JSProxy> NewJSProxy(Handle<Object> handler, Handle<Object> prototype); | 391 Handle<JSProxy> NewJSProxy(Handle<Object> handler, Handle<Object> prototype); |
| 390 | 392 |
| 393 // Allocates a Harmony function proxy. |
| 391 Handle<JSProxy> NewJSFunctionProxy(Handle<Object> handler, | 394 Handle<JSProxy> NewJSFunctionProxy(Handle<Object> handler, |
| 392 Handle<Object> call_trap, | 395 Handle<Object> call_trap, |
| 393 Handle<Object> construct_trap, | 396 Handle<Object> construct_trap, |
| 394 Handle<Object> prototype); | 397 Handle<Object> prototype); |
| 395 | 398 |
| 396 // Reinitialize a JSReceiver into an (empty) JS object of respective type and | 399 // Reinitialize a JSReceiver into an (empty) JS object of respective type and |
| 397 // size, but keeping the original prototype. The receiver must have at least | 400 // size, but keeping the original prototype. The receiver must have at least |
| 398 // the size of the new object. The object is reinitialized and behaves as an | 401 // the size of the new object. The object is reinitialized and behaves as an |
| 399 // object that has been freshly allocated. | 402 // object that has been freshly allocated. |
| 400 void ReinitializeJSReceiver( | 403 void ReinitializeJSReceiver( |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 return Handle<String>(BitCast<String**>( \ | 541 return Handle<String>(BitCast<String**>( \ |
| 539 &isolate()->heap()->roots_[Heap::k##name##RootIndex])); \ | 542 &isolate()->heap()->roots_[Heap::k##name##RootIndex])); \ |
| 540 } | 543 } |
| 541 INTERNALIZED_STRING_LIST(STRING_ACCESSOR) | 544 INTERNALIZED_STRING_LIST(STRING_ACCESSOR) |
| 542 #undef STRING_ACCESSOR | 545 #undef STRING_ACCESSOR |
| 543 | 546 |
| 544 Handle<String> hidden_string() { | 547 Handle<String> hidden_string() { |
| 545 return Handle<String>(&isolate()->heap()->hidden_string_); | 548 return Handle<String>(&isolate()->heap()->hidden_string_); |
| 546 } | 549 } |
| 547 | 550 |
| 551 // Allocates a new SharedFunctionInfo object. |
| 548 Handle<SharedFunctionInfo> NewSharedFunctionInfo( | 552 Handle<SharedFunctionInfo> NewSharedFunctionInfo( |
| 549 Handle<String> name, | 553 Handle<String> name, |
| 550 int number_of_literals, | 554 int number_of_literals, |
| 551 bool is_generator, | 555 bool is_generator, |
| 552 Handle<Code> code, | 556 Handle<Code> code, |
| 553 Handle<ScopeInfo> scope_info); | 557 Handle<ScopeInfo> scope_info); |
| 554 Handle<SharedFunctionInfo> NewSharedFunctionInfo(Handle<String> name); | 558 Handle<SharedFunctionInfo> NewSharedFunctionInfo(Handle<String> name); |
| 555 | 559 |
| 560 // Allocates a new JSMessageObject object. |
| 556 Handle<JSMessageObject> NewJSMessageObject( | 561 Handle<JSMessageObject> NewJSMessageObject( |
| 557 Handle<String> type, | 562 Handle<String> type, |
| 558 Handle<JSArray> arguments, | 563 Handle<JSArray> arguments, |
| 559 int start_position, | 564 int start_position, |
| 560 int end_position, | 565 int end_position, |
| 561 Handle<Object> script, | 566 Handle<Object> script, |
| 562 Handle<Object> stack_frames); | 567 Handle<Object> stack_frames); |
| 563 | 568 |
| 564 Handle<SeededNumberDictionary> DictionaryAtNumberPut( | 569 Handle<SeededNumberDictionary> DictionaryAtNumberPut( |
| 565 Handle<SeededNumberDictionary>, | 570 Handle<SeededNumberDictionary>, |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 | 643 |
| 639 // Update the map cache in the native context with (keys, map) | 644 // Update the map cache in the native context with (keys, map) |
| 640 Handle<MapCache> AddToMapCache(Handle<Context> context, | 645 Handle<MapCache> AddToMapCache(Handle<Context> context, |
| 641 Handle<FixedArray> keys, | 646 Handle<FixedArray> keys, |
| 642 Handle<Map> map); | 647 Handle<Map> map); |
| 643 }; | 648 }; |
| 644 | 649 |
| 645 } } // namespace v8::internal | 650 } } // namespace v8::internal |
| 646 | 651 |
| 647 #endif // V8_FACTORY_H_ | 652 #endif // V8_FACTORY_H_ |
| OLD | NEW |