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

Side by Side Diff: src/frames.cc

Issue 12254007: Make the Isolate parameter mandatory for internal HandleScopes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 7 years, 10 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/frames.h ('k') | src/handles.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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 private: 81 private:
82 const Address limit_; 82 const Address limit_;
83 StackHandler* handler_; 83 StackHandler* handler_;
84 }; 84 };
85 85
86 86
87 // ------------------------------------------------------------------------- 87 // -------------------------------------------------------------------------
88 88
89 89
90 #define INITIALIZE_SINGLETON(type, field) field##_(this), 90 #define INITIALIZE_SINGLETON(type, field) field##_(this),
91 StackFrameIterator::StackFrameIterator()
92 : isolate_(Isolate::Current()),
93 STACK_FRAME_TYPE_LIST(INITIALIZE_SINGLETON)
94 frame_(NULL), handler_(NULL),
95 thread_(isolate_->thread_local_top()),
96 fp_(NULL), sp_(NULL), advance_(&StackFrameIterator::AdvanceWithHandler) {
97 Reset();
98 }
99 StackFrameIterator::StackFrameIterator(Isolate* isolate) 91 StackFrameIterator::StackFrameIterator(Isolate* isolate)
100 : isolate_(isolate), 92 : isolate_(isolate),
101 STACK_FRAME_TYPE_LIST(INITIALIZE_SINGLETON) 93 STACK_FRAME_TYPE_LIST(INITIALIZE_SINGLETON)
102 frame_(NULL), handler_(NULL), 94 frame_(NULL), handler_(NULL),
103 thread_(isolate_->thread_local_top()), 95 thread_(isolate_->thread_local_top()),
104 fp_(NULL), sp_(NULL), advance_(&StackFrameIterator::AdvanceWithHandler) { 96 fp_(NULL), sp_(NULL), advance_(&StackFrameIterator::AdvanceWithHandler) {
105 Reset(); 97 Reset();
106 } 98 }
107 StackFrameIterator::StackFrameIterator(Isolate* isolate, ThreadLocalTop* t) 99 StackFrameIterator::StackFrameIterator(Isolate* isolate, ThreadLocalTop* t)
108 : isolate_(isolate), 100 : isolate_(isolate),
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 } 195 }
204 return result; 196 return result;
205 197
206 #undef FRAME_TYPE_CASE 198 #undef FRAME_TYPE_CASE
207 } 199 }
208 200
209 201
210 // ------------------------------------------------------------------------- 202 // -------------------------------------------------------------------------
211 203
212 204
213 StackTraceFrameIterator::StackTraceFrameIterator() {
214 if (!done() && !IsValidFrame()) Advance();
215 }
216
217
218 StackTraceFrameIterator::StackTraceFrameIterator(Isolate* isolate) 205 StackTraceFrameIterator::StackTraceFrameIterator(Isolate* isolate)
219 : JavaScriptFrameIterator(isolate) { 206 : JavaScriptFrameIterator(isolate) {
220 if (!done() && !IsValidFrame()) Advance(); 207 if (!done() && !IsValidFrame()) Advance();
221 } 208 }
222 209
223 210
224 void StackTraceFrameIterator::Advance() { 211 void StackTraceFrameIterator::Advance() {
225 while (true) { 212 while (true) {
226 JavaScriptFrameIterator::Advance(); 213 JavaScriptFrameIterator::Advance();
227 if (done()) return; 214 if (done()) return;
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 int offset = static_cast<int>(pc() - code_pointer->address()); 763 int offset = static_cast<int>(pc() - code_pointer->address());
777 FrameSummary summary(receiver(), 764 FrameSummary summary(receiver(),
778 JSFunction::cast(function()), 765 JSFunction::cast(function()),
779 code_pointer, 766 code_pointer,
780 offset, 767 offset,
781 IsConstructor()); 768 IsConstructor());
782 functions->Add(summary); 769 functions->Add(summary);
783 } 770 }
784 771
785 772
786 void JavaScriptFrame::PrintTop(FILE* file, 773 void JavaScriptFrame::PrintTop(Isolate* isolate,
774 FILE* file,
787 bool print_args, 775 bool print_args,
788 bool print_line_number) { 776 bool print_line_number) {
789 // constructor calls 777 // constructor calls
790 HandleScope scope; 778 HandleScope scope(isolate);
791 AssertNoAllocation no_allocation; 779 AssertNoAllocation no_allocation;
792 JavaScriptFrameIterator it; 780 JavaScriptFrameIterator it(isolate);
793 while (!it.done()) { 781 while (!it.done()) {
794 if (it.frame()->is_java_script()) { 782 if (it.frame()->is_java_script()) {
795 JavaScriptFrame* frame = it.frame(); 783 JavaScriptFrame* frame = it.frame();
796 if (frame->IsConstructor()) PrintF(file, "new "); 784 if (frame->IsConstructor()) PrintF(file, "new ");
797 // function name 785 // function name
798 Object* maybe_fun = frame->function(); 786 Object* maybe_fun = frame->function();
799 if (maybe_fun->IsJSFunction()) { 787 if (maybe_fun->IsJSFunction()) {
800 JSFunction* fun = JSFunction::cast(maybe_fun); 788 JSFunction* fun = JSFunction::cast(maybe_fun);
801 fun->PrintName(); 789 fun->PrintName();
802 Code* js_code = frame->unchecked_code(); 790 Code* js_code = frame->unchecked_code();
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 void StackFrame::PrintIndex(StringStream* accumulator, 1065 void StackFrame::PrintIndex(StringStream* accumulator,
1078 PrintMode mode, 1066 PrintMode mode,
1079 int index) { 1067 int index) {
1080 accumulator->Add((mode == OVERVIEW) ? "%5d: " : "[%d]: ", index); 1068 accumulator->Add((mode == OVERVIEW) ? "%5d: " : "[%d]: ", index);
1081 } 1069 }
1082 1070
1083 1071
1084 void JavaScriptFrame::Print(StringStream* accumulator, 1072 void JavaScriptFrame::Print(StringStream* accumulator,
1085 PrintMode mode, 1073 PrintMode mode,
1086 int index) const { 1074 int index) const {
1087 HandleScope scope; 1075 HandleScope scope(isolate());
1088 Object* receiver = this->receiver(); 1076 Object* receiver = this->receiver();
1089 Object* function = this->function(); 1077 Object* function = this->function();
1090 1078
1091 accumulator->PrintSecurityTokenIfChanged(function); 1079 accumulator->PrintSecurityTokenIfChanged(function);
1092 PrintIndex(accumulator, mode, index); 1080 PrintIndex(accumulator, mode, index);
1093 Code* code = NULL; 1081 Code* code = NULL;
1094 if (IsConstructor()) accumulator->Add("new "); 1082 if (IsConstructor()) accumulator->Add("new ");
1095 accumulator->PrintFunction(function, receiver, &code); 1083 accumulator->PrintFunction(function, receiver, &code);
1096 1084
1097 // Get scope information for nicer output, if possible. If code is NULL, or 1085 // Get scope information for nicer output, if possible. If code is NULL, or
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
1493 } 1481 }
1494 1482
1495 switch (frame->type()) { 1483 switch (frame->type()) {
1496 STACK_FRAME_TYPE_LIST(FRAME_TYPE_CASE) 1484 STACK_FRAME_TYPE_LIST(FRAME_TYPE_CASE)
1497 default: UNREACHABLE(); 1485 default: UNREACHABLE();
1498 } 1486 }
1499 #undef FRAME_TYPE_CASE 1487 #undef FRAME_TYPE_CASE
1500 return NULL; 1488 return NULL;
1501 } 1489 }
1502 1490
1503 Vector<StackFrame*> CreateStackMap(Zone* zone) { 1491 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone) {
1504 ZoneList<StackFrame*> list(10, zone); 1492 ZoneList<StackFrame*> list(10, zone);
1505 for (StackFrameIterator it; !it.done(); it.Advance()) { 1493 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) {
1506 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); 1494 StackFrame* frame = AllocateFrameCopy(it.frame(), zone);
1507 list.Add(frame, zone); 1495 list.Add(frame, zone);
1508 } 1496 }
1509 return list.ToVector(); 1497 return list.ToVector();
1510 } 1498 }
1511 1499
1512 1500
1513 } } // namespace v8::internal 1501 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/frames.h ('k') | src/handles.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698