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

Side by Side Diff: src/messages.cc

Issue 1510833003: Improve the CallSite constructor (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « src/messages.h ('k') | test/mjsunit/callsite.js » ('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 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
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( 147 Handle<Object> maybe_function = JSObject::GetDataProperty(
148 call_site_obj, isolate->factory()->call_site_function_symbol()); 148 call_site_obj, isolate->factory()->call_site_function_symbol());
149 if (!maybe_function->IsJSFunction()) return; 149 if (!maybe_function->IsJSFunction()) return;
150 150
151 fun_ = Handle<JSFunction>::cast(maybe_function); 151 fun_ = Handle<JSFunction>::cast(maybe_function);
152 receiver_ = JSObject::GetDataProperty( 152 receiver_ = JSObject::GetDataProperty(
153 call_site_obj, isolate->factory()->call_site_receiver_symbol()); 153 call_site_obj, isolate->factory()->call_site_receiver_symbol());
154 pos_ = Handle<Smi>::cast(JSObject::GetDataProperty( 154 CHECK(JSObject::GetDataProperty(
155 call_site_obj, 155 call_site_obj, isolate->factory()->call_site_position_symbol())
156 isolate->factory()->call_site_position_symbol())) 156 ->ToInt32(&pos_));
157 ->value();
158 } 157 }
159 158
160 159
161 Handle<Object> CallSite::GetFileName() { 160 Handle<Object> CallSite::GetFileName() {
162 Handle<Object> script(fun_->shared()->script(), isolate_); 161 Handle<Object> script(fun_->shared()->script(), isolate_);
163 if (script->IsScript()) { 162 if (script->IsScript()) {
164 return Handle<Object>(Handle<Script>::cast(script)->name(), isolate_); 163 return Handle<Object>(Handle<Script>::cast(script)->name(), isolate_);
165 } 164 }
166 return isolate_->factory()->null_value(); 165 return isolate_->factory()->null_value();
167 } 166 }
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 builder.AppendCharacter(*c); 385 builder.AppendCharacter(*c);
387 } 386 }
388 } 387 }
389 388
390 return builder.Finish(); 389 return builder.Finish();
391 } 390 }
392 391
393 392
394 } // namespace internal 393 } // namespace internal
395 } // namespace v8 394 } // namespace v8
OLDNEW
« no previous file with comments | « src/messages.h ('k') | test/mjsunit/callsite.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698