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

Side by Side Diff: src/top.cc

Issue 1148007: Merge bleeding_edge from version 2.1.3 up to revision 4205... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/partial_snapshots/
Patch Set: Created 10 years, 9 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
« src/runtime.cc ('K') | « src/top.h ('k') | src/utils.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 81 }
82 82
83 83
84 char* Top::Iterate(ObjectVisitor* v, char* thread_storage) { 84 char* Top::Iterate(ObjectVisitor* v, char* thread_storage) {
85 ThreadLocalTop* thread = reinterpret_cast<ThreadLocalTop*>(thread_storage); 85 ThreadLocalTop* thread = reinterpret_cast<ThreadLocalTop*>(thread_storage);
86 Iterate(v, thread); 86 Iterate(v, thread);
87 return thread_storage + sizeof(ThreadLocalTop); 87 return thread_storage + sizeof(ThreadLocalTop);
88 } 88 }
89 89
90 90
91 void Top::IterateThread(ThreadVisitor* v) {
92 v->VisitThread(&thread_local_);
93 }
94
95
96 void Top::IterateThread(ThreadVisitor* v, char* t) {
97 ThreadLocalTop* thread = reinterpret_cast<ThreadLocalTop*>(t);
98 v->VisitThread(thread);
99 }
100
101
91 void Top::Iterate(ObjectVisitor* v, ThreadLocalTop* thread) { 102 void Top::Iterate(ObjectVisitor* v, ThreadLocalTop* thread) {
92 v->VisitPointer(&(thread->pending_exception_)); 103 v->VisitPointer(&(thread->pending_exception_));
93 v->VisitPointer(&(thread->pending_message_obj_)); 104 v->VisitPointer(&(thread->pending_message_obj_));
94 v->VisitPointer( 105 v->VisitPointer(
95 bit_cast<Object**, Script**>(&(thread->pending_message_script_))); 106 BitCast<Object**, Script**>(&(thread->pending_message_script_)));
96 v->VisitPointer(bit_cast<Object**, Context**>(&(thread->context_))); 107 v->VisitPointer(BitCast<Object**, Context**>(&(thread->context_)));
97 v->VisitPointer(&(thread->scheduled_exception_)); 108 v->VisitPointer(&(thread->scheduled_exception_));
98 109
99 for (v8::TryCatch* block = thread->TryCatchHandler(); 110 for (v8::TryCatch* block = thread->TryCatchHandler();
100 block != NULL; 111 block != NULL;
101 block = TRY_CATCH_FROM_ADDRESS(block->next_)) { 112 block = TRY_CATCH_FROM_ADDRESS(block->next_)) {
102 v->VisitPointer(bit_cast<Object**, void**>(&(block->exception_))); 113 v->VisitPointer(BitCast<Object**, void**>(&(block->exception_)));
103 v->VisitPointer(bit_cast<Object**, void**>(&(block->message_))); 114 v->VisitPointer(BitCast<Object**, void**>(&(block->message_)));
104 } 115 }
105 116
106 // Iterate over pointers on native execution stack. 117 // Iterate over pointers on native execution stack.
107 for (StackFrameIterator it(thread); !it.done(); it.Advance()) { 118 for (StackFrameIterator it(thread); !it.done(); it.Advance()) {
108 it.frame()->Iterate(v); 119 it.frame()->Iterate(v);
109 } 120 }
110 } 121 }
111 122
112 123
113 void Top::Iterate(ObjectVisitor* v) { 124 void Top::Iterate(ObjectVisitor* v) {
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 void Top::ReportFailedAccessCheck(JSObject* receiver, v8::AccessType type) { 443 void Top::ReportFailedAccessCheck(JSObject* receiver, v8::AccessType type) {
433 if (!thread_local_.failed_access_check_callback_) return; 444 if (!thread_local_.failed_access_check_callback_) return;
434 445
435 ASSERT(receiver->IsAccessCheckNeeded()); 446 ASSERT(receiver->IsAccessCheckNeeded());
436 ASSERT(Top::context()); 447 ASSERT(Top::context());
437 // The callers of this method are not expecting a GC. 448 // The callers of this method are not expecting a GC.
438 AssertNoAllocation no_gc; 449 AssertNoAllocation no_gc;
439 450
440 // Get the data object from access check info. 451 // Get the data object from access check info.
441 JSFunction* constructor = JSFunction::cast(receiver->map()->constructor()); 452 JSFunction* constructor = JSFunction::cast(receiver->map()->constructor());
442 Object* info = constructor->shared()->function_data(); 453 if (!constructor->shared()->IsApiFunction()) return;
443 if (info == Heap::undefined_value()) return; 454 Object* data_obj =
444 455 constructor->shared()->get_api_func_data()->access_check_info();
445 Object* data_obj = FunctionTemplateInfo::cast(info)->access_check_info();
446 if (data_obj == Heap::undefined_value()) return; 456 if (data_obj == Heap::undefined_value()) return;
447 457
448 HandleScope scope; 458 HandleScope scope;
449 Handle<JSObject> receiver_handle(receiver); 459 Handle<JSObject> receiver_handle(receiver);
450 Handle<Object> data(AccessCheckInfo::cast(data_obj)->data()); 460 Handle<Object> data(AccessCheckInfo::cast(data_obj)->data());
451 thread_local_.failed_access_check_callback_( 461 thread_local_.failed_access_check_callback_(
452 v8::Utils::ToLocal(receiver_handle), 462 v8::Utils::ToLocal(receiver_handle),
453 type, 463 type,
454 v8::Utils::ToLocal(data)); 464 v8::Utils::ToLocal(data));
455 } 465 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 505
496 // Check for compatibility between the security tokens in the 506 // Check for compatibility between the security tokens in the
497 // current lexical context and the accessed object. 507 // current lexical context and the accessed object.
498 ASSERT(Top::context()); 508 ASSERT(Top::context());
499 509
500 MayAccessDecision decision = MayAccessPreCheck(receiver, type); 510 MayAccessDecision decision = MayAccessPreCheck(receiver, type);
501 if (decision != UNKNOWN) return decision == YES; 511 if (decision != UNKNOWN) return decision == YES;
502 512
503 // Get named access check callback 513 // Get named access check callback
504 JSFunction* constructor = JSFunction::cast(receiver->map()->constructor()); 514 JSFunction* constructor = JSFunction::cast(receiver->map()->constructor());
505 Object* info = constructor->shared()->function_data(); 515 if (!constructor->shared()->IsApiFunction()) return false;
506 if (info == Heap::undefined_value()) return false;
507 516
508 Object* data_obj = FunctionTemplateInfo::cast(info)->access_check_info(); 517 Object* data_obj =
518 constructor->shared()->get_api_func_data()->access_check_info();
509 if (data_obj == Heap::undefined_value()) return false; 519 if (data_obj == Heap::undefined_value()) return false;
510 520
511 Object* fun_obj = AccessCheckInfo::cast(data_obj)->named_callback(); 521 Object* fun_obj = AccessCheckInfo::cast(data_obj)->named_callback();
512 v8::NamedSecurityCallback callback = 522 v8::NamedSecurityCallback callback =
513 v8::ToCData<v8::NamedSecurityCallback>(fun_obj); 523 v8::ToCData<v8::NamedSecurityCallback>(fun_obj);
514 524
515 if (!callback) return false; 525 if (!callback) return false;
516 526
517 HandleScope scope; 527 HandleScope scope;
518 Handle<JSObject> receiver_handle(receiver); 528 Handle<JSObject> receiver_handle(receiver);
(...skipping 21 matching lines...) Expand all
540 // current lexical context and the accessed object. 550 // current lexical context and the accessed object.
541 ASSERT(Top::context()); 551 ASSERT(Top::context());
542 // The callers of this method are not expecting a GC. 552 // The callers of this method are not expecting a GC.
543 AssertNoAllocation no_gc; 553 AssertNoAllocation no_gc;
544 554
545 MayAccessDecision decision = MayAccessPreCheck(receiver, type); 555 MayAccessDecision decision = MayAccessPreCheck(receiver, type);
546 if (decision != UNKNOWN) return decision == YES; 556 if (decision != UNKNOWN) return decision == YES;
547 557
548 // Get indexed access check callback 558 // Get indexed access check callback
549 JSFunction* constructor = JSFunction::cast(receiver->map()->constructor()); 559 JSFunction* constructor = JSFunction::cast(receiver->map()->constructor());
550 Object* info = constructor->shared()->function_data(); 560 if (!constructor->shared()->IsApiFunction()) return false;
551 if (info == Heap::undefined_value()) return false;
552 561
553 Object* data_obj = FunctionTemplateInfo::cast(info)->access_check_info(); 562 Object* data_obj =
563 constructor->shared()->get_api_func_data()->access_check_info();
554 if (data_obj == Heap::undefined_value()) return false; 564 if (data_obj == Heap::undefined_value()) return false;
555 565
556 Object* fun_obj = AccessCheckInfo::cast(data_obj)->indexed_callback(); 566 Object* fun_obj = AccessCheckInfo::cast(data_obj)->indexed_callback();
557 v8::IndexedSecurityCallback callback = 567 v8::IndexedSecurityCallback callback =
558 v8::ToCData<v8::IndexedSecurityCallback>(fun_obj); 568 v8::ToCData<v8::IndexedSecurityCallback>(fun_obj);
559 569
560 if (!callback) return false; 570 if (!callback) return false;
561 571
562 HandleScope scope; 572 HandleScope scope;
563 Handle<JSObject> receiver_handle(receiver); 573 Handle<JSObject> receiver_handle(receiver);
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 } 953 }
944 } 954 }
945 #endif // ENABLE_DEBUGGER_SUPPORT 955 #endif // ENABLE_DEBUGGER_SUPPORT
946 if (it.done()) return Handle<Context>::null(); 956 if (it.done()) return Handle<Context>::null();
947 JavaScriptFrame* frame = it.frame(); 957 JavaScriptFrame* frame = it.frame();
948 Context* context = Context::cast(frame->context()); 958 Context* context = Context::cast(frame->context());
949 return Handle<Context>(context->global_context()); 959 return Handle<Context>(context->global_context());
950 } 960 }
951 961
952 962
953 bool Top::CanHaveSpecialFunctions(JSObject* object) {
954 return object->IsJSArray();
955 }
956
957
958 Object* Top::LookupSpecialFunction(JSObject* receiver,
959 JSObject* prototype,
960 JSFunction* function) {
961 if (CanHaveSpecialFunctions(receiver)) {
962 FixedArray* table = context()->global_context()->special_function_table();
963 for (int index = 0; index < table->length(); index +=3) {
964 if ((prototype == table->get(index)) &&
965 (function == table->get(index+1))) {
966 return table->get(index+2);
967 }
968 }
969 }
970 return Heap::undefined_value();
971 }
972
973
974 char* Top::ArchiveThread(char* to) { 963 char* Top::ArchiveThread(char* to) {
975 memcpy(to, reinterpret_cast<char*>(&thread_local_), sizeof(thread_local_)); 964 memcpy(to, reinterpret_cast<char*>(&thread_local_), sizeof(thread_local_));
976 InitializeThreadLocal(); 965 InitializeThreadLocal();
977 return to + sizeof(thread_local_); 966 return to + sizeof(thread_local_);
978 } 967 }
979 968
980 969
981 char* Top::RestoreThread(char* from) { 970 char* Top::RestoreThread(char* from) {
982 memcpy(reinterpret_cast<char*>(&thread_local_), from, sizeof(thread_local_)); 971 memcpy(reinterpret_cast<char*>(&thread_local_), from, sizeof(thread_local_));
983 return from + sizeof(thread_local_); 972 return from + sizeof(thread_local_);
984 } 973 }
985 974
986 975
987 ExecutionAccess::ExecutionAccess() { 976 ExecutionAccess::ExecutionAccess() {
988 Top::break_access_->Lock(); 977 Top::break_access_->Lock();
989 } 978 }
990 979
991 980
992 ExecutionAccess::~ExecutionAccess() { 981 ExecutionAccess::~ExecutionAccess() {
993 Top::break_access_->Unlock(); 982 Top::break_access_->Unlock();
994 } 983 }
995 984
996 985
997 } } // namespace v8::internal 986 } } // namespace v8::internal
OLDNEW
« src/runtime.cc ('K') | « src/top.h ('k') | src/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698