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

Side by Side Diff: src/isolate.cc

Issue 23536007: Add scriptId to StackTrace frames. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Created 7 years, 3 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
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 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 Handle<JSArray> Isolate::CaptureCurrentStackTrace( 727 Handle<JSArray> Isolate::CaptureCurrentStackTrace(
728 int frame_limit, StackTrace::StackTraceOptions options) { 728 int frame_limit, StackTrace::StackTraceOptions options) {
729 // Ensure no negative values. 729 // Ensure no negative values.
730 int limit = Max(frame_limit, 0); 730 int limit = Max(frame_limit, 0);
731 Handle<JSArray> stack_trace = factory()->NewJSArray(frame_limit); 731 Handle<JSArray> stack_trace = factory()->NewJSArray(frame_limit);
732 732
733 Handle<String> column_key = 733 Handle<String> column_key =
734 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("column")); 734 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("column"));
735 Handle<String> line_key = 735 Handle<String> line_key =
736 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("lineNumber")); 736 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("lineNumber"));
737 Handle<String> script_key = 737 Handle<String> script_id_key =
738 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("scriptId"));
739 Handle<String> script_name_key =
738 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("scriptName")); 740 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("scriptName"));
739 Handle<String> script_name_or_source_url_key = 741 Handle<String> script_name_or_source_url_key =
740 factory()->InternalizeOneByteString( 742 factory()->InternalizeOneByteString(
741 STATIC_ASCII_VECTOR("scriptNameOrSourceURL")); 743 STATIC_ASCII_VECTOR("scriptNameOrSourceURL"));
742 Handle<String> function_key = 744 Handle<String> function_key =
743 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("functionName")); 745 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("functionName"));
744 Handle<String> eval_key = 746 Handle<String> eval_key =
745 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("isEval")); 747 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("isEval"));
746 Handle<String> constructor_key = 748 Handle<String> constructor_key =
747 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("isConstructor")); 749 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("isConstructor"));
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 stack_frame, column_key, 785 stack_frame, column_key,
784 Handle<Smi>(Smi::FromInt(column_offset + 1), this), NONE)); 786 Handle<Smi>(Smi::FromInt(column_offset + 1), this), NONE));
785 } 787 }
786 CHECK_NOT_EMPTY_HANDLE( 788 CHECK_NOT_EMPTY_HANDLE(
787 this, 789 this,
788 JSObject::SetLocalPropertyIgnoreAttributes( 790 JSObject::SetLocalPropertyIgnoreAttributes(
789 stack_frame, line_key, 791 stack_frame, line_key,
790 Handle<Smi>(Smi::FromInt(line_number + 1), this), NONE)); 792 Handle<Smi>(Smi::FromInt(line_number + 1), this), NONE));
791 } 793 }
792 794
795 if (options & StackTrace::kScriptId) {
796 Handle<Smi> script_id(script->id(), this);
797 CHECK_NOT_EMPTY_HANDLE(this,
798 JSObject::SetLocalPropertyIgnoreAttributes(
799 stack_frame, script_id_key, script_id,
800 NONE));
801 }
802
793 if (options & StackTrace::kScriptName) { 803 if (options & StackTrace::kScriptName) {
794 Handle<Object> script_name(script->name(), this); 804 Handle<Object> script_name(script->name(), this);
795 CHECK_NOT_EMPTY_HANDLE(this, 805 CHECK_NOT_EMPTY_HANDLE(this,
796 JSObject::SetLocalPropertyIgnoreAttributes( 806 JSObject::SetLocalPropertyIgnoreAttributes(
797 stack_frame, script_key, script_name, NONE)); 807 stack_frame, script_name_key, script_name,
808 NONE));
798 } 809 }
799 810
800 if (options & StackTrace::kScriptNameOrSourceURL) { 811 if (options & StackTrace::kScriptNameOrSourceURL) {
801 Handle<Object> result = GetScriptNameOrSourceURL(script); 812 Handle<Object> result = GetScriptNameOrSourceURL(script);
802 CHECK_NOT_EMPTY_HANDLE(this, 813 CHECK_NOT_EMPTY_HANDLE(this,
803 JSObject::SetLocalPropertyIgnoreAttributes( 814 JSObject::SetLocalPropertyIgnoreAttributes(
804 stack_frame, script_name_or_source_url_key, 815 stack_frame, script_name_or_source_url_key,
805 result, NONE)); 816 result, NONE));
806 } 817 }
807 818
(...skipping 1708 matching lines...) Expand 10 before | Expand all | Expand 10 after
2516 2527
2517 #ifdef DEBUG 2528 #ifdef DEBUG
2518 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ 2529 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \
2519 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); 2530 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_);
2520 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) 2531 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET)
2521 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) 2532 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET)
2522 #undef ISOLATE_FIELD_OFFSET 2533 #undef ISOLATE_FIELD_OFFSET
2523 #endif 2534 #endif
2524 2535
2525 } } // namespace v8::internal 2536 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/api.cc ('k') | test/cctest/test-api.cc » ('j') | test/cctest/test-api.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698