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

Side by Side Diff: src/api.h

Issue 430503007: Rename ASSERT* to DCHECK*. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE and fixes Created 6 years, 4 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/allocation-tracker.cc ('k') | src/api.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 // 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_API_H_ 5 #ifndef V8_API_H_
6 #define V8_API_H_ 6 #define V8_API_H_
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "include/v8-testing.h" 10 #include "include/v8-testing.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 NeanderObject::NeanderObject(v8::internal::Object* obj) 74 NeanderObject::NeanderObject(v8::internal::Object* obj)
75 : value_(v8::internal::Handle<v8::internal::JSObject>( 75 : value_(v8::internal::Handle<v8::internal::JSObject>(
76 v8::internal::JSObject::cast(obj))) { } 76 v8::internal::JSObject::cast(obj))) { }
77 77
78 78
79 NeanderArray::NeanderArray(v8::internal::Handle<v8::internal::Object> obj) 79 NeanderArray::NeanderArray(v8::internal::Handle<v8::internal::Object> obj)
80 : obj_(obj) { } 80 : obj_(obj) { }
81 81
82 82
83 v8::internal::Object* NeanderObject::get(int offset) { 83 v8::internal::Object* NeanderObject::get(int offset) {
84 ASSERT(value()->HasFastObjectElements()); 84 DCHECK(value()->HasFastObjectElements());
85 return v8::internal::FixedArray::cast(value()->elements())->get(offset); 85 return v8::internal::FixedArray::cast(value()->elements())->get(offset);
86 } 86 }
87 87
88 88
89 void NeanderObject::set(int offset, v8::internal::Object* value) { 89 void NeanderObject::set(int offset, v8::internal::Object* value) {
90 ASSERT(value_->HasFastObjectElements()); 90 DCHECK(value_->HasFastObjectElements());
91 v8::internal::FixedArray::cast(value_->elements())->set(offset, value); 91 v8::internal::FixedArray::cast(value_->elements())->set(offset, value);
92 } 92 }
93 93
94 94
95 template <typename T> inline T ToCData(v8::internal::Object* obj) { 95 template <typename T> inline T ToCData(v8::internal::Object* obj) {
96 STATIC_ASSERT(sizeof(T) == sizeof(v8::internal::Address)); 96 STATIC_ASSERT(sizeof(T) == sizeof(v8::internal::Address));
97 return reinterpret_cast<T>( 97 return reinterpret_cast<T>(
98 reinterpret_cast<intptr_t>( 98 reinterpret_cast<intptr_t>(
99 v8::internal::Foreign::cast(obj)->foreign_address())); 99 v8::internal::Foreign::cast(obj)->foreign_address()));
100 } 100 }
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 #define DECLARE_OPEN_HANDLE(From, To) \ 257 #define DECLARE_OPEN_HANDLE(From, To) \
258 static inline v8::internal::Handle<v8::internal::To> \ 258 static inline v8::internal::Handle<v8::internal::To> \
259 OpenHandle(const From* that, bool allow_empty_handle = false); 259 OpenHandle(const From* that, bool allow_empty_handle = false);
260 260
261 OPEN_HANDLE_LIST(DECLARE_OPEN_HANDLE) 261 OPEN_HANDLE_LIST(DECLARE_OPEN_HANDLE)
262 262
263 #undef DECLARE_OPEN_HANDLE 263 #undef DECLARE_OPEN_HANDLE
264 264
265 template<class From, class To> 265 template<class From, class To>
266 static inline Local<To> Convert(v8::internal::Handle<From> obj) { 266 static inline Local<To> Convert(v8::internal::Handle<From> obj) {
267 ASSERT(obj.is_null() || !obj->IsTheHole()); 267 DCHECK(obj.is_null() || !obj->IsTheHole());
268 return Local<To>(reinterpret_cast<To*>(obj.location())); 268 return Local<To>(reinterpret_cast<To*>(obj.location()));
269 } 269 }
270 270
271 template <class T> 271 template <class T>
272 static inline v8::internal::Handle<v8::internal::Object> OpenPersistent( 272 static inline v8::internal::Handle<v8::internal::Object> OpenPersistent(
273 const v8::Persistent<T>& persistent) { 273 const v8::Persistent<T>& persistent) {
274 return v8::internal::Handle<v8::internal::Object>( 274 return v8::internal::Handle<v8::internal::Object>(
275 reinterpret_cast<v8::internal::Object**>(persistent.val_)); 275 reinterpret_cast<v8::internal::Object**>(persistent.val_));
276 } 276 }
277 277
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 318
319 #define MAKE_TO_LOCAL(Name, From, To) \ 319 #define MAKE_TO_LOCAL(Name, From, To) \
320 Local<v8::To> Utils::Name(v8::internal::Handle<v8::internal::From> obj) { \ 320 Local<v8::To> Utils::Name(v8::internal::Handle<v8::internal::From> obj) { \
321 return Convert<v8::internal::From, v8::To>(obj); \ 321 return Convert<v8::internal::From, v8::To>(obj); \
322 } 322 }
323 323
324 324
325 #define MAKE_TO_LOCAL_TYPED_ARRAY(Type, typeName, TYPE, ctype, size) \ 325 #define MAKE_TO_LOCAL_TYPED_ARRAY(Type, typeName, TYPE, ctype, size) \
326 Local<v8::Type##Array> Utils::ToLocal##Type##Array( \ 326 Local<v8::Type##Array> Utils::ToLocal##Type##Array( \
327 v8::internal::Handle<v8::internal::JSTypedArray> obj) { \ 327 v8::internal::Handle<v8::internal::JSTypedArray> obj) { \
328 ASSERT(obj->type() == kExternal##Type##Array); \ 328 DCHECK(obj->type() == kExternal##Type##Array); \
329 return Convert<v8::internal::JSTypedArray, v8::Type##Array>(obj); \ 329 return Convert<v8::internal::JSTypedArray, v8::Type##Array>(obj); \
330 } 330 }
331 331
332 332
333 MAKE_TO_LOCAL(ToLocal, Context, Context) 333 MAKE_TO_LOCAL(ToLocal, Context, Context)
334 MAKE_TO_LOCAL(ToLocal, Object, Value) 334 MAKE_TO_LOCAL(ToLocal, Object, Value)
335 MAKE_TO_LOCAL(ToLocal, JSFunction, Function) 335 MAKE_TO_LOCAL(ToLocal, JSFunction, Function)
336 MAKE_TO_LOCAL(ToLocal, String, String) 336 MAKE_TO_LOCAL(ToLocal, String, String)
337 MAKE_TO_LOCAL(ToLocal, Symbol, Symbol) 337 MAKE_TO_LOCAL(ToLocal, Symbol, Symbol)
338 MAKE_TO_LOCAL(ToLocal, JSRegExp, RegExp) 338 MAKE_TO_LOCAL(ToLocal, JSRegExp, RegExp)
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 inline Handle<Context> LastEnteredContext(); 527 inline Handle<Context> LastEnteredContext();
528 528
529 inline void SaveContext(Context* context); 529 inline void SaveContext(Context* context);
530 inline Context* RestoreContext(); 530 inline Context* RestoreContext();
531 inline bool HasSavedContexts(); 531 inline bool HasSavedContexts();
532 532
533 inline List<internal::Object**>* blocks() { return &blocks_; } 533 inline List<internal::Object**>* blocks() { return &blocks_; }
534 Isolate* isolate() const { return isolate_; } 534 Isolate* isolate() const { return isolate_; }
535 535
536 void ReturnBlock(Object** block) { 536 void ReturnBlock(Object** block) {
537 ASSERT(block != NULL); 537 DCHECK(block != NULL);
538 if (spare_ != NULL) DeleteArray(spare_); 538 if (spare_ != NULL) DeleteArray(spare_);
539 spare_ = block; 539 spare_ = block;
540 } 540 }
541 541
542 private: 542 private:
543 void ResetAfterArchive() { 543 void ResetAfterArchive() {
544 blocks_.Initialize(0); 544 blocks_.Initialize(0);
545 entered_contexts_.Initialize(0); 545 entered_contexts_.Initialize(0);
546 saved_contexts_.Initialize(0); 546 saved_contexts_.Initialize(0);
547 spare_ = NULL; 547 spare_ = NULL;
548 last_handle_before_deferred_block_ = NULL; 548 last_handle_before_deferred_block_ = NULL;
549 call_depth_ = 0; 549 call_depth_ = 0;
550 } 550 }
551 551
552 void Free() { 552 void Free() {
553 ASSERT(blocks_.length() == 0); 553 DCHECK(blocks_.length() == 0);
554 ASSERT(entered_contexts_.length() == 0); 554 DCHECK(entered_contexts_.length() == 0);
555 ASSERT(saved_contexts_.length() == 0); 555 DCHECK(saved_contexts_.length() == 0);
556 blocks_.Free(); 556 blocks_.Free();
557 entered_contexts_.Free(); 557 entered_contexts_.Free();
558 saved_contexts_.Free(); 558 saved_contexts_.Free();
559 if (spare_ != NULL) { 559 if (spare_ != NULL) {
560 DeleteArray(spare_); 560 DeleteArray(spare_);
561 spare_ = NULL; 561 spare_ = NULL;
562 } 562 }
563 ASSERT(call_depth_ == 0); 563 DCHECK(call_depth_ == 0);
564 } 564 }
565 565
566 void BeginDeferredScope(); 566 void BeginDeferredScope();
567 DeferredHandles* Detach(Object** prev_limit); 567 DeferredHandles* Detach(Object** prev_limit);
568 568
569 Isolate* isolate_; 569 Isolate* isolate_;
570 List<internal::Object**> blocks_; 570 List<internal::Object**> blocks_;
571 // Used as a stack to keep track of entered contexts. 571 // Used as a stack to keep track of entered contexts.
572 List<Context*> entered_contexts_; 572 List<Context*> entered_contexts_;
573 // Used as a stack to keep track of saved contexts. 573 // Used as a stack to keep track of saved contexts.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 656
657 blocks_.RemoveLast(); 657 blocks_.RemoveLast();
658 #ifdef ENABLE_HANDLE_ZAPPING 658 #ifdef ENABLE_HANDLE_ZAPPING
659 internal::HandleScope::ZapRange(block_start, block_limit); 659 internal::HandleScope::ZapRange(block_start, block_limit);
660 #endif 660 #endif
661 if (spare_ != NULL) { 661 if (spare_ != NULL) {
662 DeleteArray(spare_); 662 DeleteArray(spare_);
663 } 663 }
664 spare_ = block_start; 664 spare_ = block_start;
665 } 665 }
666 ASSERT((blocks_.is_empty() && prev_limit == NULL) || 666 DCHECK((blocks_.is_empty() && prev_limit == NULL) ||
667 (!blocks_.is_empty() && prev_limit != NULL)); 667 (!blocks_.is_empty() && prev_limit != NULL));
668 } 668 }
669 669
670 670
671 // Interceptor functions called from generated inline caches to notify 671 // Interceptor functions called from generated inline caches to notify
672 // CPU profiler that external callbacks are invoked. 672 // CPU profiler that external callbacks are invoked.
673 void InvokeAccessorGetterCallback( 673 void InvokeAccessorGetterCallback(
674 v8::Local<v8::String> property, 674 v8::Local<v8::String> property,
675 const v8::PropertyCallbackInfo<v8::Value>& info, 675 const v8::PropertyCallbackInfo<v8::Value>& info,
676 v8::AccessorGetterCallback getter); 676 v8::AccessorGetterCallback getter);
677 677
678 void InvokeFunctionCallback(const v8::FunctionCallbackInfo<v8::Value>& info, 678 void InvokeFunctionCallback(const v8::FunctionCallbackInfo<v8::Value>& info,
679 v8::FunctionCallback callback); 679 v8::FunctionCallback callback);
680 680
681 class Testing { 681 class Testing {
682 public: 682 public:
683 static v8::Testing::StressType stress_type() { return stress_type_; } 683 static v8::Testing::StressType stress_type() { return stress_type_; }
684 static void set_stress_type(v8::Testing::StressType stress_type) { 684 static void set_stress_type(v8::Testing::StressType stress_type) {
685 stress_type_ = stress_type; 685 stress_type_ = stress_type;
686 } 686 }
687 687
688 private: 688 private:
689 static v8::Testing::StressType stress_type_; 689 static v8::Testing::StressType stress_type_;
690 }; 690 };
691 691
692 } } // namespace v8::internal 692 } } // namespace v8::internal
693 693
694 #endif // V8_API_H_ 694 #endif // V8_API_H_
OLDNEW
« no previous file with comments | « src/allocation-tracker.cc ('k') | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698