| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 "api.h" | 5 #include "api.h" |
| 6 | 6 |
| 7 #include <string.h> // For memcpy, strlen. | 7 #include <string.h> // For memcpy, strlen. |
| 8 #include <cmath> // For isnan. | 8 #include <cmath> // For isnan. |
| 9 #ifdef V8_USE_ADDRESS_SANITIZER | 9 #ifdef V8_USE_ADDRESS_SANITIZER |
| 10 #include <sanitizer/asan_interface.h> | 10 #include <sanitizer/asan_interface.h> |
| (...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1579 i::HandleScope scope(isolate); | 1579 i::HandleScope scope(isolate); |
| 1580 i::Handle<i::SharedFunctionInfo> function_info( | 1580 i::Handle<i::SharedFunctionInfo> function_info( |
| 1581 i::SharedFunctionInfo::cast(*obj)); | 1581 i::SharedFunctionInfo::cast(*obj)); |
| 1582 i::Handle<i::Script> script(i::Script::cast(function_info->script())); | 1582 i::Handle<i::Script> script(i::Script::cast(function_info->script())); |
| 1583 return script->id()->value(); | 1583 return script->id()->value(); |
| 1584 } | 1584 } |
| 1585 } | 1585 } |
| 1586 | 1586 |
| 1587 | 1587 |
| 1588 int UnboundScript::GetLineNumber(int code_pos) { | 1588 int UnboundScript::GetLineNumber(int code_pos) { |
| 1589 i::Handle<i::HeapObject> obj = | 1589 i::Handle<i::SharedFunctionInfo> obj = |
| 1590 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this)); | 1590 i::Handle<i::SharedFunctionInfo>::cast(Utils::OpenHandle(this)); |
| 1591 i::Isolate* isolate = obj->GetIsolate(); | 1591 i::Isolate* isolate = obj->GetIsolate(); |
| 1592 ON_BAILOUT(isolate, "v8::UnboundScript::GetLineNumber()", return -1); | 1592 ON_BAILOUT(isolate, "v8::UnboundScript::GetLineNumber()", return -1); |
| 1593 LOG_API(isolate, "UnboundScript::GetLineNumber"); | 1593 LOG_API(isolate, "UnboundScript::GetLineNumber"); |
| 1594 if (obj->IsScript()) { | 1594 if (obj->script()->IsScript()) { |
| 1595 i::Handle<i::Script> script(i::Script::cast(*obj)); | 1595 i::Handle<i::Script> script(i::Script::cast(obj->script())); |
| 1596 return i::Script::GetLineNumber(script, code_pos); | 1596 return i::Script::GetLineNumber(script, code_pos); |
| 1597 } else { | 1597 } else { |
| 1598 return -1; | 1598 return -1; |
| 1599 } | 1599 } |
| 1600 } | 1600 } |
| 1601 | 1601 |
| 1602 | 1602 |
| 1603 Handle<Value> UnboundScript::GetScriptName() { | 1603 Handle<Value> UnboundScript::GetScriptName() { |
| 1604 i::Handle<i::HeapObject> obj = | 1604 i::Handle<i::SharedFunctionInfo> obj = |
| 1605 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this)); | 1605 i::Handle<i::SharedFunctionInfo>::cast(Utils::OpenHandle(this)); |
| 1606 i::Isolate* isolate = obj->GetIsolate(); | 1606 i::Isolate* isolate = obj->GetIsolate(); |
| 1607 ON_BAILOUT(isolate, "v8::UnboundScript::GetName()", | 1607 ON_BAILOUT(isolate, "v8::UnboundScript::GetName()", |
| 1608 return Handle<String>()); | 1608 return Handle<String>()); |
| 1609 LOG_API(isolate, "UnboundScript::GetName"); | 1609 LOG_API(isolate, "UnboundScript::GetName"); |
| 1610 if (obj->IsScript()) { | 1610 if (obj->script()->IsScript()) { |
| 1611 i::Object* name = i::Script::cast(*obj)->name(); | 1611 i::Object* name = i::Script::cast(obj->script())->name(); |
| 1612 return Utils::ToLocal(i::Handle<i::Object>(name, isolate)); | 1612 return Utils::ToLocal(i::Handle<i::Object>(name, isolate)); |
| 1613 } else { | 1613 } else { |
| 1614 return Handle<String>(); | 1614 return Handle<String>(); |
| 1615 } | 1615 } |
| 1616 } | 1616 } |
| 1617 | 1617 |
| 1618 | 1618 |
| 1619 Local<Value> Script::Run() { | 1619 Local<Value> Script::Run() { |
| 1620 // If execution is terminating, Compile(..)->Run() requires this | 1620 // If execution is terminating, Compile(..)->Run() requires this |
| 1621 // check. | 1621 // check. |
| (...skipping 5938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7560 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7560 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7561 Address callback_address = | 7561 Address callback_address = |
| 7562 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7562 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7563 VMState<EXTERNAL> state(isolate); | 7563 VMState<EXTERNAL> state(isolate); |
| 7564 ExternalCallbackScope call_scope(isolate, callback_address); | 7564 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7565 callback(info); | 7565 callback(info); |
| 7566 } | 7566 } |
| 7567 | 7567 |
| 7568 | 7568 |
| 7569 } } // namespace v8::internal | 7569 } } // namespace v8::internal |
| OLD | NEW |