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

Side by Side Diff: src/isolate.cc

Issue 237673014: Move functions from handles.cc to where they belong. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebox Created 6 years, 8 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/handles.cc ('k') | src/json-stringifier.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 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 for (int i = frames.length() - 1; i >= 0 && frames_seen < limit; i--) { 524 for (int i = frames.length() - 1; i >= 0 && frames_seen < limit; i--) {
525 // Create a JSObject to hold the information for the StackFrame. 525 // Create a JSObject to hold the information for the StackFrame.
526 Handle<JSObject> stack_frame = factory()->NewJSObject(object_function()); 526 Handle<JSObject> stack_frame = factory()->NewJSObject(object_function());
527 527
528 Handle<JSFunction> fun = frames[i].function(); 528 Handle<JSFunction> fun = frames[i].function();
529 Handle<Script> script(Script::cast(fun->shared()->script())); 529 Handle<Script> script(Script::cast(fun->shared()->script()));
530 530
531 if (options & StackTrace::kLineNumber) { 531 if (options & StackTrace::kLineNumber) {
532 int script_line_offset = script->line_offset()->value(); 532 int script_line_offset = script->line_offset()->value();
533 int position = frames[i].code()->SourcePosition(frames[i].pc()); 533 int position = frames[i].code()->SourcePosition(frames[i].pc());
534 int line_number = GetScriptLineNumber(script, position); 534 int line_number = Script::GetLineNumber(script, position);
535 // line_number is already shifted by the script_line_offset. 535 // line_number is already shifted by the script_line_offset.
536 int relative_line_number = line_number - script_line_offset; 536 int relative_line_number = line_number - script_line_offset;
537 if (options & StackTrace::kColumnOffset && relative_line_number >= 0) { 537 if (options & StackTrace::kColumnOffset && relative_line_number >= 0) {
538 Handle<FixedArray> line_ends(FixedArray::cast(script->line_ends())); 538 Handle<FixedArray> line_ends(FixedArray::cast(script->line_ends()));
539 int start = (relative_line_number == 0) ? 0 : 539 int start = (relative_line_number == 0) ? 0 :
540 Smi::cast(line_ends->get(relative_line_number - 1))->value() + 1; 540 Smi::cast(line_ends->get(relative_line_number - 1))->value() + 1;
541 int column_offset = position - start; 541 int column_offset = position - start;
542 if (relative_line_number == 0) { 542 if (relative_line_number == 0) {
543 // For the case where the code is on the same line as the script 543 // For the case where the code is on the same line as the script
544 // tag. 544 // tag.
(...skipping 14 matching lines...) Expand all
559 stack_frame, script_id_key, script_id, NONE).Check(); 559 stack_frame, script_id_key, script_id, NONE).Check();
560 } 560 }
561 561
562 if (options & StackTrace::kScriptName) { 562 if (options & StackTrace::kScriptName) {
563 Handle<Object> script_name(script->name(), this); 563 Handle<Object> script_name(script->name(), this);
564 JSObject::SetLocalPropertyIgnoreAttributes( 564 JSObject::SetLocalPropertyIgnoreAttributes(
565 stack_frame, script_name_key, script_name, NONE).Check(); 565 stack_frame, script_name_key, script_name, NONE).Check();
566 } 566 }
567 567
568 if (options & StackTrace::kScriptNameOrSourceURL) { 568 if (options & StackTrace::kScriptNameOrSourceURL) {
569 Handle<Object> result = GetScriptNameOrSourceURL(script); 569 Handle<Object> result = Script::GetNameOrSourceURL(script);
570 JSObject::SetLocalPropertyIgnoreAttributes( 570 JSObject::SetLocalPropertyIgnoreAttributes(
571 stack_frame, script_name_or_source_url_key, result, NONE).Check(); 571 stack_frame, script_name_or_source_url_key, result, NONE).Check();
572 } 572 }
573 573
574 if (options & StackTrace::kFunctionName) { 574 if (options & StackTrace::kFunctionName) {
575 Handle<Object> fun_name(fun->shared()->name(), this); 575 Handle<Object> fun_name(fun->shared()->name(), this);
576 if (!fun_name->BooleanValue()) { 576 if (!fun_name->BooleanValue()) {
577 fun_name = Handle<Object>(fun->shared()->inferred_name(), this); 577 fun_name = Handle<Object>(fun->shared()->inferred_name(), this);
578 } 578 }
579 JSObject::SetLocalPropertyIgnoreAttributes( 579 JSObject::SetLocalPropertyIgnoreAttributes(
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 // At this point we cannot create an Error object using its javascript 824 // At this point we cannot create an Error object using its javascript
825 // constructor. Instead, we copy the pre-constructed boilerplate and 825 // constructor. Instead, we copy the pre-constructed boilerplate and
826 // attach the stack trace as a hidden property. 826 // attach the stack trace as a hidden property.
827 Handle<String> key = factory()->stack_overflow_string(); 827 Handle<String> key = factory()->stack_overflow_string();
828 Handle<JSObject> boilerplate = Handle<JSObject>::cast( 828 Handle<JSObject> boilerplate = Handle<JSObject>::cast(
829 Object::GetProperty(js_builtins_object(), key).ToHandleChecked()); 829 Object::GetProperty(js_builtins_object(), key).ToHandleChecked());
830 Handle<JSObject> exception = JSObject::Copy(boilerplate); 830 Handle<JSObject> exception = JSObject::Copy(boilerplate);
831 DoThrow(*exception, NULL); 831 DoThrow(*exception, NULL);
832 832
833 // Get stack trace limit. 833 // Get stack trace limit.
834 Handle<Object> error = 834 Handle<Object> error = Object::GetProperty(
835 GetProperty(js_builtins_object(), "$Error").ToHandleChecked(); 835 this, js_builtins_object(), "$Error").ToHandleChecked();
836 if (!error->IsJSObject()) return Failure::Exception(); 836 if (!error->IsJSObject()) return Failure::Exception();
837 837
838 Handle<String> stackTraceLimit = 838 Handle<String> stackTraceLimit =
839 factory()->InternalizeUtf8String("stackTraceLimit"); 839 factory()->InternalizeUtf8String("stackTraceLimit");
840 ASSERT(!stackTraceLimit.is_null()); 840 ASSERT(!stackTraceLimit.is_null());
841 Handle<Object> stack_trace_limit = 841 Handle<Object> stack_trace_limit =
842 JSObject::GetDataProperty(Handle<JSObject>::cast(error), 842 JSObject::GetDataProperty(Handle<JSObject>::cast(error),
843 stackTraceLimit); 843 stackTraceLimit);
844 if (!stack_trace_limit->IsNumber()) return Failure::Exception(); 844 if (!stack_trace_limit->IsNumber()) return Failure::Exception();
845 double dlimit = stack_trace_limit->Number(); 845 double dlimit = stack_trace_limit->Number();
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 MessageHandler::GetLocalizedMessage(this, message_obj).get()); 1142 MessageHandler::GetLocalizedMessage(this, message_obj).get());
1143 PrintCurrentStackTrace(stderr); 1143 PrintCurrentStackTrace(stderr);
1144 OS::Abort(); 1144 OS::Abort();
1145 } 1145 }
1146 } else if (location != NULL && !location->script().is_null()) { 1146 } else if (location != NULL && !location->script().is_null()) {
1147 // We are bootstrapping and caught an error where the location is set 1147 // We are bootstrapping and caught an error where the location is set
1148 // and we have a script for the location. 1148 // and we have a script for the location.
1149 // In this case we could have an extension (or an internal error 1149 // In this case we could have an extension (or an internal error
1150 // somewhere) and we print out the line number at which the error occured 1150 // somewhere) and we print out the line number at which the error occured
1151 // to the console for easier debugging. 1151 // to the console for easier debugging.
1152 int line_number = GetScriptLineNumberSafe(location->script(), 1152 int line_number =
1153 location->start_pos()); 1153 location->script()->GetLineNumber(location->start_pos()) + 1;
1154 if (exception->IsString() && location->script()->name()->IsString()) { 1154 if (exception->IsString() && location->script()->name()->IsString()) {
1155 OS::PrintError( 1155 OS::PrintError(
1156 "Extension or internal compilation error: %s in %s at line %d.\n", 1156 "Extension or internal compilation error: %s in %s at line %d.\n",
1157 String::cast(exception)->ToCString().get(), 1157 String::cast(exception)->ToCString().get(),
1158 String::cast(location->script()->name())->ToCString().get(), 1158 String::cast(location->script()->name())->ToCString().get(),
1159 line_number + 1); 1159 line_number);
1160 } else if (location->script()->name()->IsString()) { 1160 } else if (location->script()->name()->IsString()) {
1161 OS::PrintError( 1161 OS::PrintError(
1162 "Extension or internal compilation error in %s at line %d.\n", 1162 "Extension or internal compilation error in %s at line %d.\n",
1163 String::cast(location->script()->name())->ToCString().get(), 1163 String::cast(location->script()->name())->ToCString().get(),
1164 line_number + 1); 1164 line_number);
1165 } else { 1165 } else {
1166 OS::PrintError("Extension or internal compilation error.\n"); 1166 OS::PrintError("Extension or internal compilation error.\n");
1167 } 1167 }
1168 } 1168 }
1169 } 1169 }
1170 1170
1171 // Save the message for reporting if the the exception remains uncaught. 1171 // Save the message for reporting if the the exception remains uncaught.
1172 thread_local_top()->has_pending_message_ = report_exception; 1172 thread_local_top()->has_pending_message_ = report_exception;
1173 1173
1174 // Do not forget to clean catcher_ if currently thrown exception cannot 1174 // Do not forget to clean catcher_ if currently thrown exception cannot
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after
2262 Handle<JSObject> obj = factory()->NewJSObjectFromMap(map); 2262 Handle<JSObject> obj = factory()->NewJSObjectFromMap(map);
2263 JSObject::NormalizeProperties(obj, KEEP_INOBJECT_PROPERTIES, 8); 2263 JSObject::NormalizeProperties(obj, KEEP_INOBJECT_PROPERTIES, 8);
2264 JSObject::SetProperty(registry, name, obj, NONE, STRICT).Assert(); 2264 JSObject::SetProperty(registry, name, obj, NONE, STRICT).Assert();
2265 } 2265 }
2266 } 2266 }
2267 return Handle<JSObject>::cast(factory()->symbol_registry()); 2267 return Handle<JSObject>::cast(factory()->symbol_registry());
2268 } 2268 }
2269 2269
2270 2270
2271 } } // namespace v8::internal 2271 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/handles.cc ('k') | src/json-stringifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698