| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1455 | 1455 |
| 1456 | 1456 |
| 1457 Local<Script> Script::New(v8::Handle<String> source, | 1457 Local<Script> Script::New(v8::Handle<String> source, |
| 1458 v8::ScriptOrigin* origin, | 1458 v8::ScriptOrigin* origin, |
| 1459 v8::ScriptData* pre_data, | 1459 v8::ScriptData* pre_data, |
| 1460 v8::Handle<String> script_data) { | 1460 v8::Handle<String> script_data) { |
| 1461 i::Isolate* isolate = i::Isolate::Current(); | 1461 i::Isolate* isolate = i::Isolate::Current(); |
| 1462 ON_BAILOUT(isolate, "v8::Script::New()", return Local<Script>()); | 1462 ON_BAILOUT(isolate, "v8::Script::New()", return Local<Script>()); |
| 1463 LOG_API(isolate, "Script::New"); | 1463 LOG_API(isolate, "Script::New"); |
| 1464 ENTER_V8(isolate); | 1464 ENTER_V8(isolate); |
| 1465 i::Handle<i::String> str = Utils::OpenHandle(*source); | 1465 i::SharedFunctionInfo* raw_result = NULL; |
| 1466 i::Handle<i::Object> name_obj; | 1466 { i::HandleScope scope(isolate); |
| 1467 int line_offset = 0; | 1467 i::Handle<i::String> str = Utils::OpenHandle(*source); |
| 1468 int column_offset = 0; | 1468 i::Handle<i::Object> name_obj; |
| 1469 if (origin != NULL) { | 1469 int line_offset = 0; |
| 1470 if (!origin->ResourceName().IsEmpty()) { | 1470 int column_offset = 0; |
| 1471 name_obj = Utils::OpenHandle(*origin->ResourceName()); | 1471 if (origin != NULL) { |
| 1472 if (!origin->ResourceName().IsEmpty()) { |
| 1473 name_obj = Utils::OpenHandle(*origin->ResourceName()); |
| 1474 } |
| 1475 if (!origin->ResourceLineOffset().IsEmpty()) { |
| 1476 line_offset = static_cast<int>(origin->ResourceLineOffset()->Value()); |
| 1477 } |
| 1478 if (!origin->ResourceColumnOffset().IsEmpty()) { |
| 1479 column_offset = |
| 1480 static_cast<int>(origin->ResourceColumnOffset()->Value()); |
| 1481 } |
| 1472 } | 1482 } |
| 1473 if (!origin->ResourceLineOffset().IsEmpty()) { | 1483 EXCEPTION_PREAMBLE(isolate); |
| 1474 line_offset = static_cast<int>(origin->ResourceLineOffset()->Value()); | 1484 i::ScriptDataImpl* pre_data_impl = |
| 1485 static_cast<i::ScriptDataImpl*>(pre_data); |
| 1486 // We assert that the pre-data is sane, even though we can actually |
| 1487 // handle it if it turns out not to be in release mode. |
| 1488 ASSERT(pre_data_impl == NULL || pre_data_impl->SanityCheck()); |
| 1489 // If the pre-data isn't sane we simply ignore it |
| 1490 if (pre_data_impl != NULL && !pre_data_impl->SanityCheck()) { |
| 1491 pre_data_impl = NULL; |
| 1475 } | 1492 } |
| 1476 if (!origin->ResourceColumnOffset().IsEmpty()) { | 1493 i::Handle<i::SharedFunctionInfo> result = |
| 1477 column_offset = static_cast<int>(origin->ResourceColumnOffset()->Value()); | |
| 1478 } | |
| 1479 } | |
| 1480 EXCEPTION_PREAMBLE(isolate); | |
| 1481 i::ScriptDataImpl* pre_data_impl = static_cast<i::ScriptDataImpl*>(pre_data); | |
| 1482 // We assert that the pre-data is sane, even though we can actually | |
| 1483 // handle it if it turns out not to be in release mode. | |
| 1484 ASSERT(pre_data_impl == NULL || pre_data_impl->SanityCheck()); | |
| 1485 // If the pre-data isn't sane we simply ignore it | |
| 1486 if (pre_data_impl != NULL && !pre_data_impl->SanityCheck()) { | |
| 1487 pre_data_impl = NULL; | |
| 1488 } | |
| 1489 i::Handle<i::SharedFunctionInfo> result = | |
| 1490 i::Compiler::Compile(str, | 1494 i::Compiler::Compile(str, |
| 1491 name_obj, | 1495 name_obj, |
| 1492 line_offset, | 1496 line_offset, |
| 1493 column_offset, | 1497 column_offset, |
| 1494 NULL, | 1498 NULL, |
| 1495 pre_data_impl, | 1499 pre_data_impl, |
| 1496 Utils::OpenHandle(*script_data), | 1500 Utils::OpenHandle(*script_data), |
| 1497 i::NOT_NATIVES_CODE); | 1501 i::NOT_NATIVES_CODE); |
| 1498 has_pending_exception = result.is_null(); | 1502 has_pending_exception = result.is_null(); |
| 1499 EXCEPTION_BAILOUT_CHECK(isolate, Local<Script>()); | 1503 EXCEPTION_BAILOUT_CHECK(isolate, Local<Script>()); |
| 1504 raw_result = *result; |
| 1505 } |
| 1506 i::Handle<i::SharedFunctionInfo> result(raw_result, isolate); |
| 1500 return Local<Script>(ToApi<Script>(result)); | 1507 return Local<Script>(ToApi<Script>(result)); |
| 1501 } | 1508 } |
| 1502 | 1509 |
| 1503 | 1510 |
| 1504 Local<Script> Script::New(v8::Handle<String> source, | 1511 Local<Script> Script::New(v8::Handle<String> source, |
| 1505 v8::Handle<Value> file_name) { | 1512 v8::Handle<Value> file_name) { |
| 1506 ScriptOrigin origin(file_name); | 1513 ScriptOrigin origin(file_name); |
| 1507 return New(source, &origin); | 1514 return New(source, &origin); |
| 1508 } | 1515 } |
| 1509 | 1516 |
| (...skipping 4604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6114 | 6121 |
| 6115 | 6122 |
| 6116 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 6123 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
| 6117 HandleScopeImplementer* scope_implementer = | 6124 HandleScopeImplementer* scope_implementer = |
| 6118 reinterpret_cast<HandleScopeImplementer*>(storage); | 6125 reinterpret_cast<HandleScopeImplementer*>(storage); |
| 6119 scope_implementer->IterateThis(v); | 6126 scope_implementer->IterateThis(v); |
| 6120 return storage + ArchiveSpacePerThread(); | 6127 return storage + ArchiveSpacePerThread(); |
| 6121 } | 6128 } |
| 6122 | 6129 |
| 6123 } } // namespace v8::internal | 6130 } } // namespace v8::internal |
| OLD | NEW |