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

Side by Side Diff: src/top.cc

Issue 4070003: [Isolates] Convert more static data either to read-only or to per-isolate. (Closed)
Patch Set: Created 10 years, 1 month 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
« src/frames.h ('K') | « src/token.cc ('k') | src/unicode.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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 while (!it.done() && (frames_seen < limit)) { 184 while (!it.done() && (frames_seen < limit)) {
185 // Create a JSObject to hold the information for the StackFrame. 185 // Create a JSObject to hold the information for the StackFrame.
186 Handle<JSObject> stackFrame = factory()->NewJSObject(object_function()); 186 Handle<JSObject> stackFrame = factory()->NewJSObject(object_function());
187 187
188 JavaScriptFrame* frame = it.frame(); 188 JavaScriptFrame* frame = it.frame();
189 Handle<JSFunction> fun(JSFunction::cast(frame->function())); 189 Handle<JSFunction> fun(JSFunction::cast(frame->function()));
190 Handle<Script> script(Script::cast(fun->shared()->script())); 190 Handle<Script> script(Script::cast(fun->shared()->script()));
191 191
192 if (options & StackTrace::kLineNumber) { 192 if (options & StackTrace::kLineNumber) {
193 int script_line_offset = script->line_offset()->value(); 193 int script_line_offset = script->line_offset()->value();
194 int position = frame->code()->SourcePosition(frame->pc()); 194 int position = frame->LookupCode(this)->SourcePosition(frame->pc());
195 int line_number = GetScriptLineNumber(script, position); 195 int line_number = GetScriptLineNumber(script, position);
196 // line_number is already shifted by the script_line_offset. 196 // line_number is already shifted by the script_line_offset.
197 int relative_line_number = line_number - script_line_offset; 197 int relative_line_number = line_number - script_line_offset;
198 if (options & StackTrace::kColumnOffset && relative_line_number >= 0) { 198 if (options & StackTrace::kColumnOffset && relative_line_number >= 0) {
199 Handle<FixedArray> line_ends(FixedArray::cast(script->line_ends())); 199 Handle<FixedArray> line_ends(FixedArray::cast(script->line_ends()));
200 int start = (relative_line_number == 0) ? 0 : 200 int start = (relative_line_number == 0) ? 0 :
201 Smi::cast(line_ends->get(relative_line_number - 1))->value() + 1; 201 Smi::cast(line_ends->get(relative_line_number - 1))->value() + 1;
202 int column_offset = position - start; 202 int column_offset = position - start;
203 if (relative_line_number == 0) { 203 if (relative_line_number == 0) {
204 // For the case where the code is on the same line as the script tag. 204 // For the case where the code is on the same line as the script tag.
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 return ReThrow(thrown); 542 return ReThrow(thrown);
543 } 543 }
544 544
545 545
546 void Isolate::PrintCurrentStackTrace(FILE* out) { 546 void Isolate::PrintCurrentStackTrace(FILE* out) {
547 StackTraceFrameIterator it; 547 StackTraceFrameIterator it;
548 while (!it.done()) { 548 while (!it.done()) {
549 HandleScope scope; 549 HandleScope scope;
550 // Find code position if recorded in relocation info. 550 // Find code position if recorded in relocation info.
551 JavaScriptFrame* frame = it.frame(); 551 JavaScriptFrame* frame = it.frame();
552 int pos = frame->code()->SourcePosition(frame->pc()); 552 int pos = frame->LookupCode(this)->SourcePosition(frame->pc());
553 Handle<Object> pos_obj(Smi::FromInt(pos)); 553 Handle<Object> pos_obj(Smi::FromInt(pos));
554 // Fetch function and receiver. 554 // Fetch function and receiver.
555 Handle<JSFunction> fun(JSFunction::cast(frame->function())); 555 Handle<JSFunction> fun(JSFunction::cast(frame->function()));
556 Handle<Object> recv(frame->receiver()); 556 Handle<Object> recv(frame->receiver());
557 // Advance to the next JavaScript frame and determine if the 557 // Advance to the next JavaScript frame and determine if the
558 // current frame is the top-level frame. 558 // current frame is the top-level frame.
559 it.Advance(); 559 it.Advance();
560 Handle<Object> is_top_level = it.done() 560 Handle<Object> is_top_level = it.done()
561 ? factory()->true_value() 561 ? factory()->true_value()
562 : factory()->false_value(); 562 : factory()->false_value();
(...skipping 10 matching lines...) Expand all
573 573
574 void Isolate::ComputeLocation(MessageLocation* target) { 574 void Isolate::ComputeLocation(MessageLocation* target) {
575 *target = MessageLocation(Handle<Script>(heap_.empty_script()), -1, -1); 575 *target = MessageLocation(Handle<Script>(heap_.empty_script()), -1, -1);
576 StackTraceFrameIterator it; 576 StackTraceFrameIterator it;
577 if (!it.done()) { 577 if (!it.done()) {
578 JavaScriptFrame* frame = it.frame(); 578 JavaScriptFrame* frame = it.frame();
579 JSFunction* fun = JSFunction::cast(frame->function()); 579 JSFunction* fun = JSFunction::cast(frame->function());
580 Object* script = fun->shared()->script(); 580 Object* script = fun->shared()->script();
581 if (script->IsScript() && 581 if (script->IsScript() &&
582 !(Script::cast(script)->source()->IsUndefined())) { 582 !(Script::cast(script)->source()->IsUndefined())) {
583 int pos = frame->code()->SourcePosition(frame->pc()); 583 int pos = frame->LookupCode(this)->SourcePosition(frame->pc());
584 // Compute the location from the function and the reloc info. 584 // Compute the location from the function and the reloc info.
585 Handle<Script> casted_script(Script::cast(script)); 585 Handle<Script> casted_script(Script::cast(script));
586 *target = MessageLocation(casted_script, pos, pos + 1); 586 *target = MessageLocation(casted_script, pos, pos + 1);
587 } 587 }
588 } 588 }
589 } 589 }
590 590
591 591
592 bool Isolate::ShouldReturnException(bool* is_caught_externally, 592 bool Isolate::ShouldReturnException(bool* is_caught_externally,
593 bool catchable_by_javascript) { 593 bool catchable_by_javascript) {
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 Isolate::Current()->break_access()->Lock(); 873 Isolate::Current()->break_access()->Lock();
874 } 874 }
875 875
876 876
877 ExecutionAccess::~ExecutionAccess() { 877 ExecutionAccess::~ExecutionAccess() {
878 Isolate::Current()->break_access()->Unlock(); 878 Isolate::Current()->break_access()->Unlock();
879 } 879 }
880 880
881 881
882 } } // namespace v8::internal 882 } } // namespace v8::internal
OLDNEW
« src/frames.h ('K') | « src/token.cc ('k') | src/unicode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698