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

Side by Side Diff: src/factory.h

Issue 148503002: A64: Synchronize with r15545. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 11 months 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/extensions/i18n/overrides.js ('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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 Handle<ExternalArray> NewExternalArray( 236 Handle<ExternalArray> NewExternalArray(
237 int length, 237 int length,
238 ExternalArrayType array_type, 238 ExternalArrayType array_type,
239 void* external_pointer, 239 void* external_pointer,
240 PretenureFlag pretenure = NOT_TENURED); 240 PretenureFlag pretenure = NOT_TENURED);
241 241
242 Handle<Cell> NewCell(Handle<Object> value); 242 Handle<Cell> NewCell(Handle<Object> value);
243 243
244 Handle<PropertyCell> NewPropertyCell(Handle<Object> value); 244 Handle<PropertyCell> NewPropertyCell(Handle<Object> value);
245 245
246 Handle<AllocationSite> NewAllocationSite();
247
246 Handle<Map> NewMap( 248 Handle<Map> NewMap(
247 InstanceType type, 249 InstanceType type,
248 int instance_size, 250 int instance_size,
249 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); 251 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND);
250 252
251 Handle<JSObject> NewFunctionPrototype(Handle<JSFunction> function); 253 Handle<JSObject> NewFunctionPrototype(Handle<JSFunction> function);
252 254
253 Handle<Map> CopyWithPreallocatedFieldDescriptors(Handle<Map> map); 255 Handle<Map> CopyWithPreallocatedFieldDescriptors(Handle<Map> map);
254 256
255 // Copy the map adding more inobject properties if possible without 257 // Copy the map adding more inobject properties if possible without
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 PretenureFlag pretenure) { 559 PretenureFlag pretenure) {
558 if (Smi::IsValid(static_cast<intptr_t>(value))) { 560 if (Smi::IsValid(static_cast<intptr_t>(value))) {
559 return Handle<Object>(Smi::FromIntptr(static_cast<intptr_t>(value)), 561 return Handle<Object>(Smi::FromIntptr(static_cast<intptr_t>(value)),
560 isolate()); 562 isolate());
561 } else { 563 } else {
562 return NewNumber(static_cast<double>(value), pretenure); 564 return NewNumber(static_cast<double>(value), pretenure);
563 } 565 }
564 } 566 }
565 567
566 568
569 // Used to "safely" transition from pointer-based runtime code to Handle-based
570 // runtime code. When a GC happens during the called Handle-based code, a
571 // failure object is returned to the pointer-based code to cause it abort and
572 // re-trigger a gc of it's own. Since this double-gc will cause the Handle-based
573 // code to be called twice, it must be idempotent.
574 class IdempotentPointerToHandleCodeTrampoline {
575 public:
576 explicit IdempotentPointerToHandleCodeTrampoline(Isolate* isolate)
577 : isolate_(isolate) {}
578
579 template<typename R>
580 MUST_USE_RESULT MaybeObject* Call(R (*function)()) {
581 int collections = isolate_->heap()->gc_count();
582 (*function)();
583 return (collections == isolate_->heap()->gc_count())
584 ? isolate_->heap()->true_value()
585 : reinterpret_cast<MaybeObject*>(Failure::RetryAfterGC());
586 }
587
588 template<typename R>
589 MUST_USE_RESULT MaybeObject* CallWithReturnValue(R (*function)()) {
590 int collections = isolate_->heap()->gc_count();
591 Object* result = (*function)();
592 return (collections == isolate_->heap()->gc_count())
593 ? result
594 : reinterpret_cast<MaybeObject*>(Failure::RetryAfterGC());
595 }
596
597 template<typename R, typename P1>
598 MUST_USE_RESULT MaybeObject* Call(R (*function)(P1), P1 p1) {
599 int collections = isolate_->heap()->gc_count();
600 (*function)(p1);
601 return (collections == isolate_->heap()->gc_count())
602 ? isolate_->heap()->true_value()
603 : reinterpret_cast<MaybeObject*>(Failure::RetryAfterGC());
604 }
605
606 template<typename R, typename P1>
607 MUST_USE_RESULT MaybeObject* CallWithReturnValue(
608 R (*function)(P1),
609 P1 p1) {
610 int collections = isolate_->heap()->gc_count();
611 Object* result = (*function)(p1);
612 return (collections == isolate_->heap()->gc_count())
613 ? result
614 : reinterpret_cast<MaybeObject*>(Failure::RetryAfterGC());
615 }
616
617 template<typename R, typename P1, typename P2>
618 MUST_USE_RESULT MaybeObject* Call(
619 R (*function)(P1, P2),
620 P1 p1,
621 P2 p2) {
622 int collections = isolate_->heap()->gc_count();
623 (*function)(p1, p2);
624 return (collections == isolate_->heap()->gc_count())
625 ? isolate_->heap()->true_value()
626 : reinterpret_cast<MaybeObject*>(Failure::RetryAfterGC());
627 }
628
629 template<typename R, typename P1, typename P2>
630 MUST_USE_RESULT MaybeObject* CallWithReturnValue(
631 R (*function)(P1, P2),
632 P1 p1,
633 P2 p2) {
634 int collections = isolate_->heap()->gc_count();
635 Object* result = (*function)(p1, p2);
636 return (collections == isolate_->heap()->gc_count())
637 ? result
638 : reinterpret_cast<MaybeObject*>(Failure::RetryAfterGC());
639 }
640
641 private:
642 Isolate* isolate_;
643 };
644
567 645
568 } } // namespace v8::internal 646 } } // namespace v8::internal
569 647
570 #endif // V8_FACTORY_H_ 648 #endif // V8_FACTORY_H_
OLDNEW
« no previous file with comments | « src/extensions/i18n/overrides.js ('k') | src/factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698