| 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 1521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1532 ASSERT(pre_data_impl == NULL || pre_data_impl->SanityCheck()); | 1532 ASSERT(pre_data_impl == NULL || pre_data_impl->SanityCheck()); |
| 1533 // If the pre-data isn't sane we simply ignore it | 1533 // If the pre-data isn't sane we simply ignore it |
| 1534 if (pre_data_impl != NULL && !pre_data_impl->SanityCheck()) { | 1534 if (pre_data_impl != NULL && !pre_data_impl->SanityCheck()) { |
| 1535 pre_data_impl = NULL; | 1535 pre_data_impl = NULL; |
| 1536 } | 1536 } |
| 1537 i::Handle<i::SharedFunctionInfo> result = | 1537 i::Handle<i::SharedFunctionInfo> result = |
| 1538 i::Compiler::Compile(str, | 1538 i::Compiler::Compile(str, |
| 1539 name_obj, | 1539 name_obj, |
| 1540 line_offset, | 1540 line_offset, |
| 1541 column_offset, | 1541 column_offset, |
| 1542 isolate->native_context(), | 1542 isolate->global_context(), |
| 1543 NULL, | 1543 NULL, |
| 1544 pre_data_impl, | 1544 pre_data_impl, |
| 1545 Utils::OpenHandle(*script_data), | 1545 Utils::OpenHandle(*script_data), |
| 1546 i::NOT_NATIVES_CODE); | 1546 i::NOT_NATIVES_CODE); |
| 1547 has_pending_exception = result.is_null(); | 1547 has_pending_exception = result.is_null(); |
| 1548 EXCEPTION_BAILOUT_CHECK(isolate, Local<Script>()); | 1548 EXCEPTION_BAILOUT_CHECK(isolate, Local<Script>()); |
| 1549 raw_result = *result; | 1549 raw_result = *result; |
| 1550 } | 1550 } |
| 1551 i::Handle<i::SharedFunctionInfo> result(raw_result, isolate); | 1551 i::Handle<i::SharedFunctionInfo> result(raw_result, isolate); |
| 1552 return Local<Script>(ToApi<Script>(result)); | 1552 return Local<Script>(ToApi<Script>(result)); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1570 ENTER_V8(isolate); | 1570 ENTER_V8(isolate); |
| 1571 Local<Script> generic = New(source, origin, pre_data, script_data); | 1571 Local<Script> generic = New(source, origin, pre_data, script_data); |
| 1572 if (generic.IsEmpty()) | 1572 if (generic.IsEmpty()) |
| 1573 return generic; | 1573 return generic; |
| 1574 i::Handle<i::Object> obj = Utils::OpenHandle(*generic); | 1574 i::Handle<i::Object> obj = Utils::OpenHandle(*generic); |
| 1575 i::Handle<i::SharedFunctionInfo> function = | 1575 i::Handle<i::SharedFunctionInfo> function = |
| 1576 i::Handle<i::SharedFunctionInfo>(i::SharedFunctionInfo::cast(*obj)); | 1576 i::Handle<i::SharedFunctionInfo>(i::SharedFunctionInfo::cast(*obj)); |
| 1577 i::Handle<i::JSFunction> result = | 1577 i::Handle<i::JSFunction> result = |
| 1578 isolate->factory()->NewFunctionFromSharedFunctionInfo( | 1578 isolate->factory()->NewFunctionFromSharedFunctionInfo( |
| 1579 function, | 1579 function, |
| 1580 isolate->native_context()); | 1580 isolate->global_context()); |
| 1581 return Local<Script>(ToApi<Script>(result)); | 1581 return Local<Script>(ToApi<Script>(result)); |
| 1582 } | 1582 } |
| 1583 | 1583 |
| 1584 | 1584 |
| 1585 Local<Script> Script::Compile(v8::Handle<String> source, | 1585 Local<Script> Script::Compile(v8::Handle<String> source, |
| 1586 v8::Handle<Value> file_name, | 1586 v8::Handle<Value> file_name, |
| 1587 v8::Handle<String> script_data) { | 1587 v8::Handle<String> script_data) { |
| 1588 ScriptOrigin origin(file_name); | 1588 ScriptOrigin origin(file_name); |
| 1589 return Compile(source, &origin, 0, script_data); | 1589 return Compile(source, &origin, 0, script_data); |
| 1590 } | 1590 } |
| 1591 | 1591 |
| 1592 | 1592 |
| 1593 Local<Value> Script::Run() { | 1593 Local<Value> Script::Run() { |
| 1594 i::Isolate* isolate = i::Isolate::Current(); | 1594 i::Isolate* isolate = i::Isolate::Current(); |
| 1595 ON_BAILOUT(isolate, "v8::Script::Run()", return Local<Value>()); | 1595 ON_BAILOUT(isolate, "v8::Script::Run()", return Local<Value>()); |
| 1596 LOG_API(isolate, "Script::Run"); | 1596 LOG_API(isolate, "Script::Run"); |
| 1597 ENTER_V8(isolate); | 1597 ENTER_V8(isolate); |
| 1598 i::Object* raw_result = NULL; | 1598 i::Object* raw_result = NULL; |
| 1599 { | 1599 { |
| 1600 i::HandleScope scope(isolate); | 1600 i::HandleScope scope(isolate); |
| 1601 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 1601 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 1602 i::Handle<i::JSFunction> fun; | 1602 i::Handle<i::JSFunction> fun; |
| 1603 if (obj->IsSharedFunctionInfo()) { | 1603 if (obj->IsSharedFunctionInfo()) { |
| 1604 i::Handle<i::SharedFunctionInfo> | 1604 i::Handle<i::SharedFunctionInfo> |
| 1605 function_info(i::SharedFunctionInfo::cast(*obj), isolate); | 1605 function_info(i::SharedFunctionInfo::cast(*obj), isolate); |
| 1606 fun = isolate->factory()->NewFunctionFromSharedFunctionInfo( | 1606 fun = isolate->factory()->NewFunctionFromSharedFunctionInfo( |
| 1607 function_info, isolate->native_context()); | 1607 function_info, isolate->global_context()); |
| 1608 } else { | 1608 } else { |
| 1609 fun = i::Handle<i::JSFunction>(i::JSFunction::cast(*obj), isolate); | 1609 fun = i::Handle<i::JSFunction>(i::JSFunction::cast(*obj), isolate); |
| 1610 } | 1610 } |
| 1611 EXCEPTION_PREAMBLE(isolate); | 1611 EXCEPTION_PREAMBLE(isolate); |
| 1612 i::Handle<i::Object> receiver( | 1612 i::Handle<i::Object> receiver( |
| 1613 isolate->context()->global_proxy(), isolate); | 1613 isolate->context()->global_proxy(), isolate); |
| 1614 i::Handle<i::Object> result = | 1614 i::Handle<i::Object> result = |
| 1615 i::Execution::Call(fun, receiver, 0, NULL, &has_pending_exception); | 1615 i::Execution::Call(fun, receiver, 0, NULL, &has_pending_exception); |
| 1616 EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<Value>()); | 1616 EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<Value>()); |
| 1617 raw_result = *result; | 1617 raw_result = *result; |
| (...skipping 2911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4529 } | 4529 } |
| 4530 | 4530 |
| 4531 | 4531 |
| 4532 void Context::ReattachGlobal(Handle<Object> global_object) { | 4532 void Context::ReattachGlobal(Handle<Object> global_object) { |
| 4533 i::Isolate* isolate = i::Isolate::Current(); | 4533 i::Isolate* isolate = i::Isolate::Current(); |
| 4534 if (IsDeadCheck(isolate, "v8::Context::ReattachGlobal()")) return; | 4534 if (IsDeadCheck(isolate, "v8::Context::ReattachGlobal()")) return; |
| 4535 ENTER_V8(isolate); | 4535 ENTER_V8(isolate); |
| 4536 i::Object** ctx = reinterpret_cast<i::Object**>(this); | 4536 i::Object** ctx = reinterpret_cast<i::Object**>(this); |
| 4537 i::Handle<i::Context> context = | 4537 i::Handle<i::Context> context = |
| 4538 i::Handle<i::Context>::cast(i::Handle<i::Object>(ctx)); | 4538 i::Handle<i::Context>::cast(i::Handle<i::Object>(ctx)); |
| 4539 isolate->bootstrapper()->ReattachGlobal( | 4539 i::Handle<i::JSGlobalProxy> global_proxy = |
| 4540 context, | 4540 i::Handle<i::JSGlobalProxy>::cast(Utils::OpenHandle(*global_object)); |
| 4541 Utils::OpenHandle(*global_object)); | 4541 isolate->bootstrapper()->ReattachGlobal(context, global_proxy); |
| 4542 } | 4542 } |
| 4543 | 4543 |
| 4544 | 4544 |
| 4545 void Context::AllowCodeGenerationFromStrings(bool allow) { | 4545 void Context::AllowCodeGenerationFromStrings(bool allow) { |
| 4546 i::Isolate* isolate = i::Isolate::Current(); | 4546 i::Isolate* isolate = i::Isolate::Current(); |
| 4547 if (IsDeadCheck(isolate, "v8::Context::AllowCodeGenerationFromStrings()")) { | 4547 if (IsDeadCheck(isolate, "v8::Context::AllowCodeGenerationFromStrings()")) { |
| 4548 return; | 4548 return; |
| 4549 } | 4549 } |
| 4550 ENTER_V8(isolate); | 4550 ENTER_V8(isolate); |
| 4551 i::Object** ctx = reinterpret_cast<i::Object**>(this); | 4551 i::Object** ctx = reinterpret_cast<i::Object**>(this); |
| (...skipping 1976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6528 | 6528 |
| 6529 v->VisitPointers(blocks_.first(), first_block_limit_); | 6529 v->VisitPointers(blocks_.first(), first_block_limit_); |
| 6530 | 6530 |
| 6531 for (int i = 1; i < blocks_.length(); i++) { | 6531 for (int i = 1; i < blocks_.length(); i++) { |
| 6532 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); | 6532 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); |
| 6533 } | 6533 } |
| 6534 } | 6534 } |
| 6535 | 6535 |
| 6536 | 6536 |
| 6537 } } // namespace v8::internal | 6537 } } // namespace v8::internal |
| OLD | NEW |