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/keys.h" | 10 #include "src/keys.h" |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 bool CallSite::IsEval() { | 347 bool CallSite::IsEval() { |
348 if (!IsJavaScript()) return false; | 348 if (!IsJavaScript()) return false; |
349 Handle<Object> script(fun_->shared()->script(), isolate_); | 349 Handle<Object> script(fun_->shared()->script(), isolate_); |
350 return script->IsScript() && | 350 return script->IsScript() && |
351 Handle<Script>::cast(script)->compilation_type() == | 351 Handle<Script>::cast(script)->compilation_type() == |
352 Script::COMPILATION_TYPE_EVAL; | 352 Script::COMPILATION_TYPE_EVAL; |
353 } | 353 } |
354 | 354 |
355 | 355 |
356 bool CallSite::IsConstructor() { | 356 bool CallSite::IsConstructor() { |
| 357 // Builtin exit frames mark constructors by passing a special symbol as the |
| 358 // receiver. |
| 359 Object* ctor_symbol = isolate_->heap()->call_site_constructor_symbol(); |
| 360 if (*receiver_ == ctor_symbol) return true; |
357 if (!IsJavaScript() || !receiver_->IsJSObject()) return false; | 361 if (!IsJavaScript() || !receiver_->IsJSObject()) return false; |
358 Handle<Object> constructor = | 362 Handle<Object> constructor = |
359 JSReceiver::GetDataProperty(Handle<JSObject>::cast(receiver_), | 363 JSReceiver::GetDataProperty(Handle<JSObject>::cast(receiver_), |
360 isolate_->factory()->constructor_string()); | 364 isolate_->factory()->constructor_string()); |
361 return constructor.is_identical_to(fun_); | 365 return constructor.is_identical_to(fun_); |
362 } | 366 } |
363 | 367 |
364 | 368 |
365 Handle<String> MessageTemplate::FormatMessage(Isolate* isolate, | 369 Handle<String> MessageTemplate::FormatMessage(Isolate* isolate, |
366 int template_index, | 370 int template_index, |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 builder.AppendCharacter(*c); | 443 builder.AppendCharacter(*c); |
440 } | 444 } |
441 } | 445 } |
442 | 446 |
443 return builder.Finish(); | 447 return builder.Finish(); |
444 } | 448 } |
445 | 449 |
446 | 450 |
447 } // namespace internal | 451 } // namespace internal |
448 } // namespace v8 | 452 } // namespace v8 |
OLD | NEW |