| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 1490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1501 return scope.Close(result); | 1501 return scope.Close(result); |
| 1502 } | 1502 } |
| 1503 | 1503 |
| 1504 | 1504 |
| 1505 v8::Handle<Value> Message::GetScriptResourceName() const { | 1505 v8::Handle<Value> Message::GetScriptResourceName() const { |
| 1506 if (IsDeadCheck("v8::Message::GetScriptResourceName()")) { | 1506 if (IsDeadCheck("v8::Message::GetScriptResourceName()")) { |
| 1507 return Local<String>(); | 1507 return Local<String>(); |
| 1508 } | 1508 } |
| 1509 ENTER_V8; | 1509 ENTER_V8; |
| 1510 HandleScope scope; | 1510 HandleScope scope; |
| 1511 i::Handle<i::JSObject> obj = | 1511 i::Handle<i::JSMessageObject> message = |
| 1512 i::Handle<i::JSObject>::cast(Utils::OpenHandle(this)); | 1512 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this)); |
| 1513 // Return this.script.name. | 1513 // Return this.script.name. |
| 1514 i::Handle<i::JSValue> script = | 1514 i::Handle<i::JSValue> script = |
| 1515 i::Handle<i::JSValue>::cast(GetProperty(obj, "script")); | 1515 i::Handle<i::JSValue>::cast(i::Handle<i::Object>(message->script())); |
| 1516 i::Handle<i::Object> resource_name(i::Script::cast(script->value())->name()); | 1516 i::Handle<i::Object> resource_name(i::Script::cast(script->value())->name()); |
| 1517 return scope.Close(Utils::ToLocal(resource_name)); | 1517 return scope.Close(Utils::ToLocal(resource_name)); |
| 1518 } | 1518 } |
| 1519 | 1519 |
| 1520 | 1520 |
| 1521 v8::Handle<Value> Message::GetScriptData() const { | 1521 v8::Handle<Value> Message::GetScriptData() const { |
| 1522 if (IsDeadCheck("v8::Message::GetScriptResourceData()")) { | 1522 if (IsDeadCheck("v8::Message::GetScriptResourceData()")) { |
| 1523 return Local<Value>(); | 1523 return Local<Value>(); |
| 1524 } | 1524 } |
| 1525 ENTER_V8; | 1525 ENTER_V8; |
| 1526 HandleScope scope; | 1526 HandleScope scope; |
| 1527 i::Handle<i::JSObject> obj = | 1527 i::Handle<i::JSMessageObject> message = |
| 1528 i::Handle<i::JSObject>::cast(Utils::OpenHandle(this)); | 1528 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this)); |
| 1529 // Return this.script.data. | 1529 // Return this.script.data. |
| 1530 i::Handle<i::JSValue> script = | 1530 i::Handle<i::JSValue> script = |
| 1531 i::Handle<i::JSValue>::cast(GetProperty(obj, "script")); | 1531 i::Handle<i::JSValue>::cast(i::Handle<i::Object>(message->script())); |
| 1532 i::Handle<i::Object> data(i::Script::cast(script->value())->data()); | 1532 i::Handle<i::Object> data(i::Script::cast(script->value())->data()); |
| 1533 return scope.Close(Utils::ToLocal(data)); | 1533 return scope.Close(Utils::ToLocal(data)); |
| 1534 } | 1534 } |
| 1535 | 1535 |
| 1536 | 1536 |
| 1537 v8::Handle<v8::StackTrace> Message::GetStackTrace() const { | 1537 v8::Handle<v8::StackTrace> Message::GetStackTrace() const { |
| 1538 if (IsDeadCheck("v8::Message::GetStackTrace()")) { | 1538 if (IsDeadCheck("v8::Message::GetStackTrace()")) { |
| 1539 return Local<v8::StackTrace>(); | 1539 return Local<v8::StackTrace>(); |
| 1540 } | 1540 } |
| 1541 ENTER_V8; | 1541 ENTER_V8; |
| 1542 HandleScope scope; | 1542 HandleScope scope; |
| 1543 i::Handle<i::JSObject> obj = | 1543 i::Handle<i::JSMessageObject> message = |
| 1544 i::Handle<i::JSObject>::cast(Utils::OpenHandle(this)); | 1544 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this)); |
| 1545 i::Handle<i::Object> stackFramesObj = GetProperty(obj, "stackFrames"); | 1545 i::Handle<i::Object> stackFramesObj(message->stack_frames()); |
| 1546 if (!stackFramesObj->IsJSArray()) return v8::Handle<v8::StackTrace>(); | 1546 if (!stackFramesObj->IsJSArray()) return v8::Handle<v8::StackTrace>(); |
| 1547 i::Handle<i::JSArray> stackTrace = | 1547 i::Handle<i::JSArray> stackTrace = |
| 1548 i::Handle<i::JSArray>::cast(stackFramesObj); | 1548 i::Handle<i::JSArray>::cast(stackFramesObj); |
| 1549 return scope.Close(Utils::StackTraceToLocal(stackTrace)); | 1549 return scope.Close(Utils::StackTraceToLocal(stackTrace)); |
| 1550 } | 1550 } |
| 1551 | 1551 |
| 1552 | 1552 |
| 1553 static i::Handle<i::Object> CallV8HeapFunction(const char* name, | 1553 static i::Handle<i::Object> CallV8HeapFunction(const char* name, |
| 1554 i::Handle<i::Object> recv, | 1554 i::Handle<i::Object> recv, |
| 1555 int argc, | 1555 int argc, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1576 1, | 1576 1, |
| 1577 argv, | 1577 argv, |
| 1578 has_pending_exception); | 1578 has_pending_exception); |
| 1579 } | 1579 } |
| 1580 | 1580 |
| 1581 | 1581 |
| 1582 int Message::GetLineNumber() const { | 1582 int Message::GetLineNumber() const { |
| 1583 ON_BAILOUT("v8::Message::GetLineNumber()", return kNoLineNumberInfo); | 1583 ON_BAILOUT("v8::Message::GetLineNumber()", return kNoLineNumberInfo); |
| 1584 ENTER_V8; | 1584 ENTER_V8; |
| 1585 HandleScope scope; | 1585 HandleScope scope; |
| 1586 |
| 1586 EXCEPTION_PREAMBLE(); | 1587 EXCEPTION_PREAMBLE(); |
| 1587 i::Handle<i::Object> result = CallV8HeapFunction("GetLineNumber", | 1588 i::Handle<i::Object> result = CallV8HeapFunction("GetLineNumber", |
| 1588 Utils::OpenHandle(this), | 1589 Utils::OpenHandle(this), |
| 1589 &has_pending_exception); | 1590 &has_pending_exception); |
| 1590 EXCEPTION_BAILOUT_CHECK(0); | 1591 EXCEPTION_BAILOUT_CHECK(0); |
| 1591 return static_cast<int>(result->Number()); | 1592 return static_cast<int>(result->Number()); |
| 1592 } | 1593 } |
| 1593 | 1594 |
| 1594 | 1595 |
| 1595 int Message::GetStartPosition() const { | 1596 int Message::GetStartPosition() const { |
| 1596 if (IsDeadCheck("v8::Message::GetStartPosition()")) return 0; | 1597 if (IsDeadCheck("v8::Message::GetStartPosition()")) return 0; |
| 1597 ENTER_V8; | 1598 ENTER_V8; |
| 1598 HandleScope scope; | 1599 HandleScope scope; |
| 1599 | 1600 i::Handle<i::JSMessageObject> message = |
| 1600 i::Handle<i::JSObject> data_obj = Utils::OpenHandle(this); | 1601 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this)); |
| 1601 return static_cast<int>(GetProperty(data_obj, "startPos")->Number()); | 1602 return message->start_position(); |
| 1602 } | 1603 } |
| 1603 | 1604 |
| 1604 | 1605 |
| 1605 int Message::GetEndPosition() const { | 1606 int Message::GetEndPosition() const { |
| 1606 if (IsDeadCheck("v8::Message::GetEndPosition()")) return 0; | 1607 if (IsDeadCheck("v8::Message::GetEndPosition()")) return 0; |
| 1607 ENTER_V8; | 1608 ENTER_V8; |
| 1608 HandleScope scope; | 1609 HandleScope scope; |
| 1609 i::Handle<i::JSObject> data_obj = Utils::OpenHandle(this); | 1610 i::Handle<i::JSMessageObject> message = |
| 1610 return static_cast<int>(GetProperty(data_obj, "endPos")->Number()); | 1611 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this)); |
| 1612 return message->end_position(); |
| 1611 } | 1613 } |
| 1612 | 1614 |
| 1613 | 1615 |
| 1614 int Message::GetStartColumn() const { | 1616 int Message::GetStartColumn() const { |
| 1615 if (IsDeadCheck("v8::Message::GetStartColumn()")) return kNoColumnInfo; | 1617 if (IsDeadCheck("v8::Message::GetStartColumn()")) return kNoColumnInfo; |
| 1616 ENTER_V8; | 1618 ENTER_V8; |
| 1617 HandleScope scope; | 1619 HandleScope scope; |
| 1618 i::Handle<i::JSObject> data_obj = Utils::OpenHandle(this); | 1620 i::Handle<i::JSObject> data_obj = Utils::OpenHandle(this); |
| 1619 EXCEPTION_PREAMBLE(); | 1621 EXCEPTION_PREAMBLE(); |
| 1620 i::Handle<i::Object> start_col_obj = CallV8HeapFunction( | 1622 i::Handle<i::Object> start_col_obj = CallV8HeapFunction( |
| 1621 "GetPositionInLine", | 1623 "GetPositionInLine", |
| 1622 data_obj, | 1624 data_obj, |
| 1623 &has_pending_exception); | 1625 &has_pending_exception); |
| 1624 EXCEPTION_BAILOUT_CHECK(0); | 1626 EXCEPTION_BAILOUT_CHECK(0); |
| 1625 return static_cast<int>(start_col_obj->Number()); | 1627 return static_cast<int>(start_col_obj->Number()); |
| 1626 } | 1628 } |
| 1627 | 1629 |
| 1628 | 1630 |
| 1629 int Message::GetEndColumn() const { | 1631 int Message::GetEndColumn() const { |
| 1630 if (IsDeadCheck("v8::Message::GetEndColumn()")) return kNoColumnInfo; | 1632 if (IsDeadCheck("v8::Message::GetEndColumn()")) return kNoColumnInfo; |
| 1631 ENTER_V8; | 1633 ENTER_V8; |
| 1632 HandleScope scope; | 1634 HandleScope scope; |
| 1633 i::Handle<i::JSObject> data_obj = Utils::OpenHandle(this); | 1635 i::Handle<i::JSObject> data_obj = Utils::OpenHandle(this); |
| 1634 EXCEPTION_PREAMBLE(); | 1636 EXCEPTION_PREAMBLE(); |
| 1635 i::Handle<i::Object> start_col_obj = CallV8HeapFunction( | 1637 i::Handle<i::Object> start_col_obj = CallV8HeapFunction( |
| 1636 "GetPositionInLine", | 1638 "GetPositionInLine", |
| 1637 data_obj, | 1639 data_obj, |
| 1638 &has_pending_exception); | 1640 &has_pending_exception); |
| 1639 EXCEPTION_BAILOUT_CHECK(0); | 1641 EXCEPTION_BAILOUT_CHECK(0); |
| 1640 int start = static_cast<int>(GetProperty(data_obj, "startPos")->Number()); | 1642 i::Handle<i::JSMessageObject> message = |
| 1641 int end = static_cast<int>(GetProperty(data_obj, "endPos")->Number()); | 1643 i::Handle<i::JSMessageObject>::cast(data_obj); |
| 1644 int start = message->start_position(); |
| 1645 int end = message->end_position(); |
| 1642 return static_cast<int>(start_col_obj->Number()) + (end - start); | 1646 return static_cast<int>(start_col_obj->Number()) + (end - start); |
| 1643 } | 1647 } |
| 1644 | 1648 |
| 1645 | 1649 |
| 1646 Local<String> Message::GetSourceLine() const { | 1650 Local<String> Message::GetSourceLine() const { |
| 1647 ON_BAILOUT("v8::Message::GetSourceLine()", return Local<String>()); | 1651 ON_BAILOUT("v8::Message::GetSourceLine()", return Local<String>()); |
| 1648 ENTER_V8; | 1652 ENTER_V8; |
| 1649 HandleScope scope; | 1653 HandleScope scope; |
| 1650 EXCEPTION_PREAMBLE(); | 1654 EXCEPTION_PREAMBLE(); |
| 1651 i::Handle<i::Object> result = CallV8HeapFunction("GetSourceLine", | 1655 i::Handle<i::Object> result = CallV8HeapFunction("GetSourceLine", |
| (...skipping 3526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5178 | 5182 |
| 5179 | 5183 |
| 5180 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 5184 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
| 5181 HandleScopeImplementer* thread_local = | 5185 HandleScopeImplementer* thread_local = |
| 5182 reinterpret_cast<HandleScopeImplementer*>(storage); | 5186 reinterpret_cast<HandleScopeImplementer*>(storage); |
| 5183 thread_local->IterateThis(v); | 5187 thread_local->IterateThis(v); |
| 5184 return storage + ArchiveSpacePerThread(); | 5188 return storage + ArchiveSpacePerThread(); |
| 5185 } | 5189 } |
| 5186 | 5190 |
| 5187 } } // namespace v8::internal | 5191 } } // namespace v8::internal |
| OLD | NEW |