OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/messages.h" | 5 #include "src/messages.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/execution.h" | 8 #include "src/execution.h" |
9 #include "src/isolate-inl.h" | 9 #include "src/isolate-inl.h" |
10 #include "src/string-builder.h" | 10 #include "src/string-builder.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 137 |
138 base::SmartArrayPointer<char> MessageHandler::GetLocalizedMessage( | 138 base::SmartArrayPointer<char> MessageHandler::GetLocalizedMessage( |
139 Isolate* isolate, Handle<Object> data) { | 139 Isolate* isolate, Handle<Object> data) { |
140 HandleScope scope(isolate); | 140 HandleScope scope(isolate); |
141 return GetMessage(isolate, data)->ToCString(DISALLOW_NULLS); | 141 return GetMessage(isolate, data)->ToCString(DISALLOW_NULLS); |
142 } | 142 } |
143 | 143 |
144 | 144 |
145 CallSite::CallSite(Isolate* isolate, Handle<JSObject> call_site_obj) | 145 CallSite::CallSite(Isolate* isolate, Handle<JSObject> call_site_obj) |
146 : isolate_(isolate) { | 146 : isolate_(isolate) { |
| 147 Handle<Object> maybe_function = JSObject::GetDataProperty( |
| 148 call_site_obj, isolate->factory()->call_site_function_symbol()); |
| 149 if (!maybe_function->IsJSFunction()) return; |
| 150 |
| 151 fun_ = Handle<JSFunction>::cast(maybe_function); |
147 receiver_ = JSObject::GetDataProperty( | 152 receiver_ = JSObject::GetDataProperty( |
148 call_site_obj, isolate->factory()->call_site_receiver_symbol()); | 153 call_site_obj, isolate->factory()->call_site_receiver_symbol()); |
149 fun_ = Handle<JSFunction>::cast(JSObject::GetDataProperty( | |
150 call_site_obj, isolate->factory()->call_site_function_symbol())); | |
151 pos_ = Handle<Smi>::cast(JSObject::GetDataProperty( | 154 pos_ = Handle<Smi>::cast(JSObject::GetDataProperty( |
152 call_site_obj, | 155 call_site_obj, |
153 isolate->factory()->call_site_position_symbol())) | 156 isolate->factory()->call_site_position_symbol())) |
154 ->value(); | 157 ->value(); |
155 } | 158 } |
156 | 159 |
157 | 160 |
158 Handle<Object> CallSite::GetFileName() { | 161 Handle<Object> CallSite::GetFileName() { |
159 Handle<Object> script(fun_->shared()->script(), isolate_); | 162 Handle<Object> script(fun_->shared()->script(), isolate_); |
160 if (script->IsScript()) { | 163 if (script->IsScript()) { |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 if (obj->IsUndefined()) return default_value; | 476 if (obj->IsUndefined()) return default_value; |
474 if (!obj->IsString()) { | 477 if (!obj->IsString()) { |
475 ASSIGN_RETURN_ON_EXCEPTION(isolate, obj, Object::ToString(isolate, obj), | 478 ASSIGN_RETURN_ON_EXCEPTION(isolate, obj, Object::ToString(isolate, obj), |
476 String); | 479 String); |
477 } | 480 } |
478 return Handle<String>::cast(obj); | 481 return Handle<String>::cast(obj); |
479 } | 482 } |
480 | 483 |
481 } // namespace internal | 484 } // namespace internal |
482 } // namespace v8 | 485 } // namespace v8 |
OLD | NEW |