OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1845 i::Handle<i::SharedFunctionInfo> function_info = OpenScript(this); | 1845 i::Handle<i::SharedFunctionInfo> function_info = OpenScript(this); |
1846 i::Handle<i::Script> script(i::Script::cast(function_info->script())); | 1846 i::Handle<i::Script> script(i::Script::cast(function_info->script())); |
1847 i::Handle<i::Object> id(script->id(), isolate); | 1847 i::Handle<i::Object> id(script->id(), isolate); |
1848 raw_id = *id; | 1848 raw_id = *id; |
1849 } | 1849 } |
1850 i::Handle<i::Object> id(raw_id, isolate); | 1850 i::Handle<i::Object> id(raw_id, isolate); |
1851 return Utils::ToLocal(id); | 1851 return Utils::ToLocal(id); |
1852 } | 1852 } |
1853 | 1853 |
1854 | 1854 |
| 1855 int Script::GetLineNumber(int code_pos) { |
| 1856 i::Isolate* isolate = i::Isolate::Current(); |
| 1857 ON_BAILOUT(isolate, "v8::Script::GetLineNumber()", return -1); |
| 1858 LOG_API(isolate, "Script::GetLineNumber"); |
| 1859 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 1860 if (obj->IsScript()) { |
| 1861 i::Handle<i::Script> script = i::Handle<i::Script>(i::Script::cast(*obj)); |
| 1862 return i::GetScriptLineNumber(script, code_pos); |
| 1863 } else { |
| 1864 return -1; |
| 1865 } |
| 1866 } |
| 1867 |
| 1868 |
| 1869 Handle<Value> Script::GetScriptName() { |
| 1870 i::Isolate* isolate = i::Isolate::Current(); |
| 1871 ON_BAILOUT(isolate, "v8::Script::GetName()", return Handle<String>()); |
| 1872 LOG_API(isolate, "Script::GetName"); |
| 1873 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 1874 if (obj->IsScript()) { |
| 1875 i::Object* name = i::Script::cast(*obj)->name(); |
| 1876 return Utils::ToLocal(i::Handle<i::Object>(name, isolate)); |
| 1877 } else { |
| 1878 return Handle<String>(); |
| 1879 } |
| 1880 } |
| 1881 |
| 1882 |
1855 void Script::SetData(v8::Handle<String> data) { | 1883 void Script::SetData(v8::Handle<String> data) { |
1856 i::Isolate* isolate = i::Isolate::Current(); | 1884 i::Isolate* isolate = i::Isolate::Current(); |
1857 ON_BAILOUT(isolate, "v8::Script::SetData()", return); | 1885 ON_BAILOUT(isolate, "v8::Script::SetData()", return); |
1858 LOG_API(isolate, "Script::SetData"); | 1886 LOG_API(isolate, "Script::SetData"); |
1859 { | 1887 { |
1860 i::HandleScope scope(isolate); | 1888 i::HandleScope scope(isolate); |
1861 i::Handle<i::SharedFunctionInfo> function_info = OpenScript(this); | 1889 i::Handle<i::SharedFunctionInfo> function_info = OpenScript(this); |
1862 i::Handle<i::Object> raw_data = Utils::OpenHandle(*data); | 1890 i::Handle<i::Object> raw_data = Utils::OpenHandle(*data); |
1863 i::Handle<i::Script> script(i::Script::cast(function_info->script())); | 1891 i::Handle<i::Script> script(i::Script::cast(function_info->script())); |
1864 script->set_data(*raw_data); | 1892 script->set_data(*raw_data); |
(...skipping 5501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7366 | 7394 |
7367 v->VisitPointers(blocks_.first(), first_block_limit_); | 7395 v->VisitPointers(blocks_.first(), first_block_limit_); |
7368 | 7396 |
7369 for (int i = 1; i < blocks_.length(); i++) { | 7397 for (int i = 1; i < blocks_.length(); i++) { |
7370 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); | 7398 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); |
7371 } | 7399 } |
7372 } | 7400 } |
7373 | 7401 |
7374 | 7402 |
7375 } } // namespace v8::internal | 7403 } } // namespace v8::internal |
OLD | NEW |