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

Side by Side Diff: src/api.cc

Issue 139393002: Removed apiutils.h and related cleanup. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Dummy for fixing codereview issues 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/api.h ('k') | src/apiutils.h » ('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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 593
594 void HandleScope::Initialize(Isolate* isolate) { 594 void HandleScope::Initialize(Isolate* isolate) {
595 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); 595 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
596 // We do not want to check the correct usage of the Locker class all over the 596 // We do not want to check the correct usage of the Locker class all over the
597 // place, so we do it only here: Without a HandleScope, an embedder can do 597 // place, so we do it only here: Without a HandleScope, an embedder can do
598 // almost nothing, so it is enough to check in this central place. 598 // almost nothing, so it is enough to check in this central place.
599 Utils::ApiCheck(!v8::Locker::IsActive() || 599 Utils::ApiCheck(!v8::Locker::IsActive() ||
600 internal_isolate->thread_manager()->IsLockedByCurrentThread(), 600 internal_isolate->thread_manager()->IsLockedByCurrentThread(),
601 "HandleScope::HandleScope", 601 "HandleScope::HandleScope",
602 "Entering the V8 API without proper locking in place"); 602 "Entering the V8 API without proper locking in place");
603 v8::ImplementationUtilities::HandleScopeData* current = 603 i::HandleScopeData* current = internal_isolate->handle_scope_data();
604 internal_isolate->handle_scope_data();
605 isolate_ = internal_isolate; 604 isolate_ = internal_isolate;
606 prev_next_ = current->next; 605 prev_next_ = current->next;
607 prev_limit_ = current->limit; 606 prev_limit_ = current->limit;
608 current->level++; 607 current->level++;
609 } 608 }
610 609
611 610
612 HandleScope::~HandleScope() { 611 HandleScope::~HandleScope() {
613 i::HandleScope::CloseScope(isolate_, prev_next_, prev_limit_); 612 i::HandleScope::CloseScope(isolate_, prev_next_, prev_limit_);
614 } 613 }
(...skipping 18 matching lines...) Expand all
633 632
634 633
635 EscapableHandleScope::EscapableHandleScope(Isolate* v8_isolate) { 634 EscapableHandleScope::EscapableHandleScope(Isolate* v8_isolate) {
636 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); 635 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
637 escape_slot_ = CreateHandle(isolate, isolate->heap()->the_hole_value()); 636 escape_slot_ = CreateHandle(isolate, isolate->heap()->the_hole_value());
638 Initialize(v8_isolate); 637 Initialize(v8_isolate);
639 } 638 }
640 639
641 640
642 i::Object** EscapableHandleScope::Escape(i::Object** escape_value) { 641 i::Object** EscapableHandleScope::Escape(i::Object** escape_value) {
643 Utils::ApiCheck(*escape_slot_ == isolate_->heap()->the_hole_value(), 642 i::Heap* heap = reinterpret_cast<i::Isolate*>(GetIsolate())->heap();
643 Utils::ApiCheck(*escape_slot_ == heap->the_hole_value(),
644 "EscapeableHandleScope::Escape", 644 "EscapeableHandleScope::Escape",
645 "Escape value set twice"); 645 "Escape value set twice");
646 if (escape_value == NULL) { 646 if (escape_value == NULL) {
647 *escape_slot_ = isolate_->heap()->undefined_value(); 647 *escape_slot_ = heap->undefined_value();
648 return NULL; 648 return NULL;
649 } 649 }
650 *escape_slot_ = *escape_value; 650 *escape_slot_ = *escape_value;
651 return escape_slot_; 651 return escape_slot_;
652 } 652 }
653 653
654 654
655 void Context::Enter() { 655 void Context::Enter() {
656 i::Handle<i::Context> env = Utils::OpenHandle(this); 656 i::Handle<i::Context> env = Utils::OpenHandle(this);
657 i::Isolate* isolate = env->GetIsolate(); 657 i::Isolate* isolate = env->GetIsolate();
(...skipping 4486 matching lines...) Expand 10 before | Expand all | Expand 10 after
5144 Local<Context> v8::Context::New( 5144 Local<Context> v8::Context::New(
5145 v8::Isolate* external_isolate, 5145 v8::Isolate* external_isolate,
5146 v8::ExtensionConfiguration* extensions, 5146 v8::ExtensionConfiguration* extensions,
5147 v8::Handle<ObjectTemplate> global_template, 5147 v8::Handle<ObjectTemplate> global_template,
5148 v8::Handle<Value> global_object) { 5148 v8::Handle<Value> global_object) {
5149 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(external_isolate); 5149 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(external_isolate);
5150 EnsureInitializedForIsolate(isolate, "v8::Context::New()"); 5150 EnsureInitializedForIsolate(isolate, "v8::Context::New()");
5151 LOG_API(isolate, "Context::New"); 5151 LOG_API(isolate, "Context::New");
5152 ON_BAILOUT(isolate, "v8::Context::New()", return Local<Context>()); 5152 ON_BAILOUT(isolate, "v8::Context::New()", return Local<Context>());
5153 i::HandleScope scope(isolate); 5153 i::HandleScope scope(isolate);
5154 ExtensionConfiguration no_extensions;
5155 if (extensions == NULL) extensions = &no_extensions;
5154 i::Handle<i::Context> env = 5156 i::Handle<i::Context> env =
5155 CreateEnvironment(isolate, extensions, global_template, global_object); 5157 CreateEnvironment(isolate, extensions, global_template, global_object);
5156 if (env.is_null()) return Local<Context>(); 5158 if (env.is_null()) return Local<Context>();
5157 return Utils::ToLocal(scope.CloseAndEscape(env)); 5159 return Utils::ToLocal(scope.CloseAndEscape(env));
5158 } 5160 }
5159 5161
5160 5162
5161 void v8::Context::SetSecurityToken(Handle<Value> token) { 5163 void v8::Context::SetSecurityToken(Handle<Value> token) {
5162 i::Isolate* isolate = i::Isolate::Current(); 5164 i::Isolate* isolate = i::Isolate::Current();
5163 ENTER_V8(isolate); 5165 ENTER_V8(isolate);
(...skipping 2096 matching lines...) Expand 10 before | Expand all | Expand 10 after
7260 7262
7261 namespace internal { 7263 namespace internal {
7262 7264
7263 7265
7264 void HandleScopeImplementer::FreeThreadResources() { 7266 void HandleScopeImplementer::FreeThreadResources() {
7265 Free(); 7267 Free();
7266 } 7268 }
7267 7269
7268 7270
7269 char* HandleScopeImplementer::ArchiveThread(char* storage) { 7271 char* HandleScopeImplementer::ArchiveThread(char* storage) {
7270 v8::ImplementationUtilities::HandleScopeData* current = 7272 HandleScopeData* current = isolate_->handle_scope_data();
7271 isolate_->handle_scope_data();
7272 handle_scope_data_ = *current; 7273 handle_scope_data_ = *current;
7273 OS::MemCopy(storage, this, sizeof(*this)); 7274 OS::MemCopy(storage, this, sizeof(*this));
7274 7275
7275 ResetAfterArchive(); 7276 ResetAfterArchive();
7276 current->Initialize(); 7277 current->Initialize();
7277 7278
7278 return storage + ArchiveSpacePerThread(); 7279 return storage + ArchiveSpacePerThread();
7279 } 7280 }
7280 7281
7281 7282
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
7322 List<Context*>* context_lists[2] = { &saved_contexts_, &entered_contexts_}; 7323 List<Context*>* context_lists[2] = { &saved_contexts_, &entered_contexts_};
7323 for (unsigned i = 0; i < ARRAY_SIZE(context_lists); i++) { 7324 for (unsigned i = 0; i < ARRAY_SIZE(context_lists); i++) {
7324 if (context_lists[i]->is_empty()) continue; 7325 if (context_lists[i]->is_empty()) continue;
7325 Object** start = reinterpret_cast<Object**>(&context_lists[i]->first()); 7326 Object** start = reinterpret_cast<Object**>(&context_lists[i]->first());
7326 v->VisitPointers(start, start + context_lists[i]->length()); 7327 v->VisitPointers(start, start + context_lists[i]->length());
7327 } 7328 }
7328 } 7329 }
7329 7330
7330 7331
7331 void HandleScopeImplementer::Iterate(ObjectVisitor* v) { 7332 void HandleScopeImplementer::Iterate(ObjectVisitor* v) {
7332 v8::ImplementationUtilities::HandleScopeData* current = 7333 HandleScopeData* current = isolate_->handle_scope_data();
7333 isolate_->handle_scope_data();
7334 handle_scope_data_ = *current; 7334 handle_scope_data_ = *current;
7335 IterateThis(v); 7335 IterateThis(v);
7336 } 7336 }
7337 7337
7338 7338
7339 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 7339 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
7340 HandleScopeImplementer* scope_implementer = 7340 HandleScopeImplementer* scope_implementer =
7341 reinterpret_cast<HandleScopeImplementer*>(storage); 7341 reinterpret_cast<HandleScopeImplementer*>(storage);
7342 scope_implementer->IterateThis(v); 7342 scope_implementer->IterateThis(v);
7343 return storage + ArchiveSpacePerThread(); 7343 return storage + ArchiveSpacePerThread();
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
7423 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7423 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7424 Address callback_address = 7424 Address callback_address =
7425 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7425 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7426 VMState<EXTERNAL> state(isolate); 7426 VMState<EXTERNAL> state(isolate);
7427 ExternalCallbackScope call_scope(isolate, callback_address); 7427 ExternalCallbackScope call_scope(isolate, callback_address);
7428 callback(info); 7428 callback(info);
7429 } 7429 }
7430 7430
7431 7431
7432 } } // namespace v8::internal 7432 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/api.h ('k') | src/apiutils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698