OLD | NEW |
---|---|
1 | 1 |
2 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 2 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
3 // Redistribution and use in source and binary forms, with or without | 3 // Redistribution and use in source and binary forms, with or without |
4 // modification, are permitted provided that the following conditions are | 4 // modification, are permitted provided that the following conditions are |
5 // met: | 5 // met: |
6 // | 6 // |
7 // * Redistributions of source code must retain the above copyright | 7 // * Redistributions of source code must retain the above copyright |
8 // notice, this list of conditions and the following disclaimer. | 8 // notice, this list of conditions and the following disclaimer. |
9 // * Redistributions in binary form must reproduce the above | 9 // * Redistributions in binary form must reproduce the above |
10 // copyright notice, this list of conditions and the following | 10 // copyright notice, this list of conditions and the following |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 } | 62 } |
63 | 63 |
64 | 64 |
65 Handle<JSMessageObject> MessageHandler::MakeMessageObject( | 65 Handle<JSMessageObject> MessageHandler::MakeMessageObject( |
66 const char* type, | 66 const char* type, |
67 MessageLocation* loc, | 67 MessageLocation* loc, |
68 Vector< Handle<Object> > args, | 68 Vector< Handle<Object> > args, |
69 Handle<String> stack_trace, | 69 Handle<String> stack_trace, |
70 Handle<JSArray> stack_frames) { | 70 Handle<JSArray> stack_frames) { |
71 Handle<String> type_handle = Factory::LookupAsciiSymbol(type); | 71 Handle<String> type_handle = Factory::LookupAsciiSymbol(type); |
72 Handle<JSArray> arguments_handle = Factory::NewJSArray(args.length()); | 72 Handle<FixedArray> arguments_elements = |
73 Factory::NewFixedArray(args.length()); | |
73 for (int i = 0; i < args.length(); i++) { | 74 for (int i = 0; i < args.length(); i++) { |
74 SetElement(arguments_handle, i, args[i]); | 75 arguments_elements->set(i, *args[i]); |
75 } | 76 } |
77 Handle<JSArray> arguments_handle = | |
78 Factory::NewJSArrayWithElements(arguments_elements); | |
Lasse Reichstein
2011/02/08 14:17:56
Is this fixing anything, or is it just a rewrite?
antonm
2011/02/08 14:30:21
It can be omitted, I wrote about that in follow up
| |
76 | 79 |
77 int start = 0; | 80 int start = 0; |
78 int end = 0; | 81 int end = 0; |
79 Handle<Object> script_handle = Factory::undefined_value(); | 82 Handle<Object> script_handle = Factory::undefined_value(); |
80 if (loc) { | 83 if (loc) { |
81 start = loc->start_pos(); | 84 start = loc->start_pos(); |
82 end = loc->end_pos(); | 85 end = loc->end_pos(); |
83 script_handle = GetScriptWrapper(loc->script()); | 86 script_handle = GetScriptWrapper(loc->script()); |
84 } | 87 } |
85 | 88 |
86 Handle<Object> stack_trace_handle = stack_trace.is_null() | 89 Handle<Object> stack_trace_handle = stack_trace.is_null() |
87 ? Factory::undefined_value() | 90 ? Factory::undefined_value() |
88 : Handle<Object>::cast(stack_trace); | 91 : Handle<Object>::cast(stack_trace); |
89 | 92 |
90 Handle<Object> stack_frames_handle = stack_frames.is_null() | 93 Handle<Object> stack_frames_handle = stack_frames.is_null() |
91 ? Factory::undefined_value() | 94 ? Factory::undefined_value() |
92 : Handle<Object>::cast(stack_frames); | 95 : Handle<Object>::cast(stack_frames); |
93 | 96 |
94 Handle<JSMessageObject> message = | 97 Handle<JSMessageObject> message = |
95 Factory::NewJSMessageObject(type_handle, | 98 Factory::NewJSMessageObject(type_handle, |
96 arguments_handle, | 99 arguments_handle, |
97 start, | 100 start, |
98 end, | 101 end, |
99 script_handle, | 102 script_handle, |
100 stack_trace_handle, | 103 stack_trace_handle, |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
152 } | 155 } |
153 | 156 |
154 | 157 |
155 SmartPointer<char> MessageHandler::GetLocalizedMessage(Handle<Object> data) { | 158 SmartPointer<char> MessageHandler::GetLocalizedMessage(Handle<Object> data) { |
156 HandleScope scope; | 159 HandleScope scope; |
157 return GetMessage(data)->ToCString(DISALLOW_NULLS); | 160 return GetMessage(data)->ToCString(DISALLOW_NULLS); |
158 } | 161 } |
159 | 162 |
160 | 163 |
161 } } // namespace v8::internal | 164 } } // namespace v8::internal |
OLD | NEW |