Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: src/factory.h

Issue 71163006: Merge bleeding_edge r17376:17693. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Fix all.gyp Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/elements.cc ('k') | src/factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 Handle<SeededNumberDictionary> NewSeededNumberDictionary( 67 Handle<SeededNumberDictionary> NewSeededNumberDictionary(
68 int at_least_space_for); 68 int at_least_space_for);
69 69
70 Handle<UnseededNumberDictionary> NewUnseededNumberDictionary( 70 Handle<UnseededNumberDictionary> NewUnseededNumberDictionary(
71 int at_least_space_for); 71 int at_least_space_for);
72 72
73 Handle<NameDictionary> NewNameDictionary(int at_least_space_for); 73 Handle<NameDictionary> NewNameDictionary(int at_least_space_for);
74 74
75 Handle<ObjectHashSet> NewObjectHashSet(int at_least_space_for); 75 Handle<ObjectHashSet> NewObjectHashSet(int at_least_space_for);
76 76
77 Handle<ObjectHashTable> NewObjectHashTable(int at_least_space_for); 77 Handle<ObjectHashTable> NewObjectHashTable(
78 int at_least_space_for,
79 MinimumCapacity capacity_option = USE_DEFAULT_MINIMUM_CAPACITY);
78 80
79 Handle<WeakHashTable> NewWeakHashTable(int at_least_space_for); 81 Handle<WeakHashTable> NewWeakHashTable(int at_least_space_for);
80 82
81 Handle<DescriptorArray> NewDescriptorArray(int number_of_descriptors, 83 Handle<DescriptorArray> NewDescriptorArray(int number_of_descriptors,
82 int slack = 0); 84 int slack = 0);
83 Handle<DeoptimizationInputData> NewDeoptimizationInputData( 85 Handle<DeoptimizationInputData> NewDeoptimizationInputData(
84 int deopt_entry_count, 86 int deopt_entry_count,
85 PretenureFlag pretenure); 87 PretenureFlag pretenure);
86 Handle<DeoptimizationOutputData> NewDeoptimizationOutputData( 88 Handle<DeoptimizationOutputData> NewDeoptimizationOutputData(
87 int deopt_entry_count, 89 int deopt_entry_count,
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 // in the system: ASCII and two byte. Unlike other String types, it does 179 // in the system: ASCII and two byte. Unlike other String types, it does
178 // not make sense to have a UTF-8 factory function for external strings, 180 // not make sense to have a UTF-8 factory function for external strings,
179 // because we cannot change the underlying buffer. 181 // because we cannot change the underlying buffer.
180 Handle<String> NewExternalStringFromAscii( 182 Handle<String> NewExternalStringFromAscii(
181 const ExternalAsciiString::Resource* resource); 183 const ExternalAsciiString::Resource* resource);
182 Handle<String> NewExternalStringFromTwoByte( 184 Handle<String> NewExternalStringFromTwoByte(
183 const ExternalTwoByteString::Resource* resource); 185 const ExternalTwoByteString::Resource* resource);
184 186
185 // Create a symbol. 187 // Create a symbol.
186 Handle<Symbol> NewSymbol(); 188 Handle<Symbol> NewSymbol();
189 Handle<Symbol> NewPrivateSymbol();
187 190
188 // Create a global (but otherwise uninitialized) context. 191 // Create a global (but otherwise uninitialized) context.
189 Handle<Context> NewNativeContext(); 192 Handle<Context> NewNativeContext();
190 193
191 // Create a global context. 194 // Create a global context.
192 Handle<Context> NewGlobalContext(Handle<JSFunction> function, 195 Handle<Context> NewGlobalContext(Handle<JSFunction> function,
193 Handle<ScopeInfo> scope_info); 196 Handle<ScopeInfo> scope_info);
194 197
195 // Create a module context. 198 // Create a module context.
196 Handle<Context> NewModuleContext(Handle<ScopeInfo> scope_info); 199 Handle<Context> NewModuleContext(Handle<ScopeInfo> scope_info);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 Handle<FixedArrayBase> elements, 337 Handle<FixedArrayBase> elements,
335 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND, 338 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND,
336 PretenureFlag pretenure = NOT_TENURED); 339 PretenureFlag pretenure = NOT_TENURED);
337 340
338 void SetElementsCapacityAndLength(Handle<JSArray> array, 341 void SetElementsCapacityAndLength(Handle<JSArray> array,
339 int capacity, 342 int capacity,
340 int length); 343 int length);
341 344
342 void SetContent(Handle<JSArray> array, Handle<FixedArrayBase> elements); 345 void SetContent(Handle<JSArray> array, Handle<FixedArrayBase> elements);
343 346
347 Handle<JSGeneratorObject> NewJSGeneratorObject(Handle<JSFunction> function);
348
344 Handle<JSArrayBuffer> NewJSArrayBuffer(); 349 Handle<JSArrayBuffer> NewJSArrayBuffer();
345 350
346 Handle<JSTypedArray> NewJSTypedArray(ExternalArrayType type); 351 Handle<JSTypedArray> NewJSTypedArray(ExternalArrayType type);
347 352
348 Handle<JSDataView> NewJSDataView(); 353 Handle<JSDataView> NewJSDataView();
349 354
350 Handle<JSProxy> NewJSProxy(Handle<Object> handler, Handle<Object> prototype); 355 Handle<JSProxy> NewJSProxy(Handle<Object> handler, Handle<Object> prototype);
351 356
352 // Change the type of the argument into a JS object/function and reinitialize. 357 // Change the type of the argument into a JS object/function and reinitialize.
353 void BecomeJSObject(Handle<JSReceiver> object); 358 void BecomeJSObject(Handle<JSReceiver> object);
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 PretenureFlag pretenure) { 582 PretenureFlag pretenure) {
578 if (Smi::IsValid(static_cast<intptr_t>(value))) { 583 if (Smi::IsValid(static_cast<intptr_t>(value))) {
579 return Handle<Object>(Smi::FromIntptr(static_cast<intptr_t>(value)), 584 return Handle<Object>(Smi::FromIntptr(static_cast<intptr_t>(value)),
580 isolate()); 585 isolate());
581 } else { 586 } else {
582 return NewNumber(static_cast<double>(value), pretenure); 587 return NewNumber(static_cast<double>(value), pretenure);
583 } 588 }
584 } 589 }
585 590
586 591
587 // Used to "safely" transition from pointer-based runtime code to Handle-based
588 // runtime code. When a GC happens during the called Handle-based code, a
589 // failure object is returned to the pointer-based code to cause it abort and
590 // re-trigger a gc of it's own. Since this double-gc will cause the Handle-based
591 // code to be called twice, it must be idempotent.
592 class IdempotentPointerToHandleCodeTrampoline {
593 public:
594 explicit IdempotentPointerToHandleCodeTrampoline(Isolate* isolate)
595 : isolate_(isolate) {}
596
597 template<typename R>
598 MUST_USE_RESULT MaybeObject* Call(R (*function)()) {
599 int collections = isolate_->heap()->gc_count();
600 (*function)();
601 return (collections == isolate_->heap()->gc_count())
602 ? isolate_->heap()->true_value()
603 : reinterpret_cast<MaybeObject*>(Failure::RetryAfterGC());
604 }
605
606 template<typename R>
607 MUST_USE_RESULT MaybeObject* CallWithReturnValue(R (*function)()) {
608 int collections = isolate_->heap()->gc_count();
609 Object* result = (*function)();
610 return (collections == isolate_->heap()->gc_count())
611 ? result
612 : reinterpret_cast<MaybeObject*>(Failure::RetryAfterGC());
613 }
614
615 template<typename R, typename P1>
616 MUST_USE_RESULT MaybeObject* Call(R (*function)(P1), P1 p1) {
617 int collections = isolate_->heap()->gc_count();
618 (*function)(p1);
619 return (collections == isolate_->heap()->gc_count())
620 ? isolate_->heap()->true_value()
621 : reinterpret_cast<MaybeObject*>(Failure::RetryAfterGC());
622 }
623
624 template<typename R, typename P1>
625 MUST_USE_RESULT MaybeObject* CallWithReturnValue(
626 R (*function)(P1),
627 P1 p1) {
628 int collections = isolate_->heap()->gc_count();
629 Object* result = (*function)(p1);
630 return (collections == isolate_->heap()->gc_count())
631 ? result
632 : reinterpret_cast<MaybeObject*>(Failure::RetryAfterGC());
633 }
634
635 template<typename R, typename P1, typename P2>
636 MUST_USE_RESULT MaybeObject* Call(
637 R (*function)(P1, P2),
638 P1 p1,
639 P2 p2) {
640 int collections = isolate_->heap()->gc_count();
641 (*function)(p1, p2);
642 return (collections == isolate_->heap()->gc_count())
643 ? isolate_->heap()->true_value()
644 : reinterpret_cast<MaybeObject*>(Failure::RetryAfterGC());
645 }
646
647 template<typename R, typename P1, typename P2>
648 MUST_USE_RESULT MaybeObject* CallWithReturnValue(
649 R (*function)(P1, P2),
650 P1 p1,
651 P2 p2) {
652 int collections = isolate_->heap()->gc_count();
653 Object* result = (*function)(p1, p2);
654 return (collections == isolate_->heap()->gc_count())
655 ? result
656 : reinterpret_cast<MaybeObject*>(Failure::RetryAfterGC());
657 }
658
659 template<typename R, typename P1, typename P2, typename P3, typename P4,
660 typename P5, typename P6, typename P7>
661 MUST_USE_RESULT MaybeObject* CallWithReturnValue(
662 R (*function)(P1, P2, P3, P4, P5, P6, P7),
663 P1 p1,
664 P2 p2,
665 P3 p3,
666 P4 p4,
667 P5 p5,
668 P6 p6,
669 P7 p7) {
670 int collections = isolate_->heap()->gc_count();
671 Handle<Object> result = (*function)(p1, p2, p3, p4, p5, p6, p7);
672 return (collections == isolate_->heap()->gc_count())
673 ? *result
674 : reinterpret_cast<MaybeObject*>(Failure::RetryAfterGC());
675 }
676
677 private:
678 Isolate* isolate_;
679 };
680
681
682 } } // namespace v8::internal 592 } } // namespace v8::internal
683 593
684 #endif // V8_FACTORY_H_ 594 #endif // V8_FACTORY_H_
OLDNEW
« no previous file with comments | « src/elements.cc ('k') | src/factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698