| 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 1437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1448 | 1448 |
| 1449 | 1449 |
| 1450 Local<Script> Script::New(v8::Handle<String> source, | 1450 Local<Script> Script::New(v8::Handle<String> source, |
| 1451 v8::ScriptOrigin* origin, | 1451 v8::ScriptOrigin* origin, |
| 1452 v8::ScriptData* pre_data, | 1452 v8::ScriptData* pre_data, |
| 1453 v8::Handle<String> script_data) { | 1453 v8::Handle<String> script_data) { |
| 1454 i::Isolate* isolate = i::Isolate::Current(); | 1454 i::Isolate* isolate = i::Isolate::Current(); |
| 1455 ON_BAILOUT(isolate, "v8::Script::New()", return Local<Script>()); | 1455 ON_BAILOUT(isolate, "v8::Script::New()", return Local<Script>()); |
| 1456 LOG_API(isolate, "Script::New"); | 1456 LOG_API(isolate, "Script::New"); |
| 1457 ENTER_V8(isolate); | 1457 ENTER_V8(isolate); |
| 1458 i::Handle<i::String> str = Utils::OpenHandle(*source); | 1458 i::SharedFunctionInfo* raw_result = NULL; |
| 1459 i::Handle<i::Object> name_obj; | 1459 { i::HandleScope scope(isolate); |
| 1460 int line_offset = 0; | 1460 i::Handle<i::String> str = Utils::OpenHandle(*source); |
| 1461 int column_offset = 0; | 1461 i::Handle<i::Object> name_obj; |
| 1462 if (origin != NULL) { | 1462 int line_offset = 0; |
| 1463 if (!origin->ResourceName().IsEmpty()) { | 1463 int column_offset = 0; |
| 1464 name_obj = Utils::OpenHandle(*origin->ResourceName()); | 1464 if (origin != NULL) { |
| 1465 if (!origin->ResourceName().IsEmpty()) { |
| 1466 name_obj = Utils::OpenHandle(*origin->ResourceName()); |
| 1467 } |
| 1468 if (!origin->ResourceLineOffset().IsEmpty()) { |
| 1469 line_offset = static_cast<int>(origin->ResourceLineOffset()->Value()); |
| 1470 } |
| 1471 if (!origin->ResourceColumnOffset().IsEmpty()) { |
| 1472 column_offset = |
| 1473 static_cast<int>(origin->ResourceColumnOffset()->Value()); |
| 1474 } |
| 1465 } | 1475 } |
| 1466 if (!origin->ResourceLineOffset().IsEmpty()) { | 1476 EXCEPTION_PREAMBLE(isolate); |
| 1467 line_offset = static_cast<int>(origin->ResourceLineOffset()->Value()); | 1477 i::ScriptDataImpl* pre_data_impl = |
| 1478 static_cast<i::ScriptDataImpl*>(pre_data); |
| 1479 // We assert that the pre-data is sane, even though we can actually |
| 1480 // handle it if it turns out not to be in release mode. |
| 1481 ASSERT(pre_data_impl == NULL || pre_data_impl->SanityCheck()); |
| 1482 // If the pre-data isn't sane we simply ignore it |
| 1483 if (pre_data_impl != NULL && !pre_data_impl->SanityCheck()) { |
| 1484 pre_data_impl = NULL; |
| 1468 } | 1485 } |
| 1469 if (!origin->ResourceColumnOffset().IsEmpty()) { | 1486 i::Handle<i::SharedFunctionInfo> result = |
| 1470 column_offset = static_cast<int>(origin->ResourceColumnOffset()->Value()); | |
| 1471 } | |
| 1472 } | |
| 1473 EXCEPTION_PREAMBLE(isolate); | |
| 1474 i::ScriptDataImpl* pre_data_impl = static_cast<i::ScriptDataImpl*>(pre_data); | |
| 1475 // We assert that the pre-data is sane, even though we can actually | |
| 1476 // handle it if it turns out not to be in release mode. | |
| 1477 ASSERT(pre_data_impl == NULL || pre_data_impl->SanityCheck()); | |
| 1478 // If the pre-data isn't sane we simply ignore it | |
| 1479 if (pre_data_impl != NULL && !pre_data_impl->SanityCheck()) { | |
| 1480 pre_data_impl = NULL; | |
| 1481 } | |
| 1482 i::Handle<i::SharedFunctionInfo> result = | |
| 1483 i::Compiler::Compile(str, | 1487 i::Compiler::Compile(str, |
| 1484 name_obj, | 1488 name_obj, |
| 1485 line_offset, | 1489 line_offset, |
| 1486 column_offset, | 1490 column_offset, |
| 1487 NULL, | 1491 NULL, |
| 1488 pre_data_impl, | 1492 pre_data_impl, |
| 1489 Utils::OpenHandle(*script_data), | 1493 Utils::OpenHandle(*script_data), |
| 1490 i::NOT_NATIVES_CODE); | 1494 i::NOT_NATIVES_CODE); |
| 1491 has_pending_exception = result.is_null(); | 1495 has_pending_exception = result.is_null(); |
| 1492 EXCEPTION_BAILOUT_CHECK(isolate, Local<Script>()); | 1496 EXCEPTION_BAILOUT_CHECK(isolate, Local<Script>()); |
| 1497 raw_result = *result; |
| 1498 } |
| 1499 i::Handle<i::SharedFunctionInfo> result(raw_result, isolate); |
| 1493 return Local<Script>(ToApi<Script>(result)); | 1500 return Local<Script>(ToApi<Script>(result)); |
| 1494 } | 1501 } |
| 1495 | 1502 |
| 1496 | 1503 |
| 1497 Local<Script> Script::New(v8::Handle<String> source, | 1504 Local<Script> Script::New(v8::Handle<String> source, |
| 1498 v8::Handle<Value> file_name) { | 1505 v8::Handle<Value> file_name) { |
| 1499 ScriptOrigin origin(file_name); | 1506 ScriptOrigin origin(file_name); |
| 1500 return New(source, &origin); | 1507 return New(source, &origin); |
| 1501 } | 1508 } |
| 1502 | 1509 |
| (...skipping 4545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6048 | 6055 |
| 6049 | 6056 |
| 6050 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 6057 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
| 6051 HandleScopeImplementer* scope_implementer = | 6058 HandleScopeImplementer* scope_implementer = |
| 6052 reinterpret_cast<HandleScopeImplementer*>(storage); | 6059 reinterpret_cast<HandleScopeImplementer*>(storage); |
| 6053 scope_implementer->IterateThis(v); | 6060 scope_implementer->IterateThis(v); |
| 6054 return storage + ArchiveSpacePerThread(); | 6061 return storage + ArchiveSpacePerThread(); |
| 6055 } | 6062 } |
| 6056 | 6063 |
| 6057 } } // namespace v8::internal | 6064 } } // namespace v8::internal |
| OLD | NEW |