| OLD | NEW |
| 1 // Copyright 2007-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2009 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 8716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8727 v8::V8::Initialize(); | 8727 v8::V8::Initialize(); |
| 8728 v8::HandleScope scope; | 8728 v8::HandleScope scope; |
| 8729 LocalContext context; | 8729 LocalContext context; |
| 8730 | 8730 |
| 8731 const char* script = "function foo(){ return 5;}\n" | 8731 const char* script = "function foo(){ return 5;}\n" |
| 8732 "function bar(){ return 6 + 7;} foo();"; | 8732 "function bar(){ return 6 + 7;} foo();"; |
| 8733 v8::ScriptData* sd = | 8733 v8::ScriptData* sd = |
| 8734 v8::ScriptData::PreCompile(script, i::StrLength(script)); | 8734 v8::ScriptData::PreCompile(script, i::StrLength(script)); |
| 8735 CHECK(!sd->HasError()); | 8735 CHECK(!sd->HasError()); |
| 8736 // ScriptDataImpl private implementation details | 8736 // ScriptDataImpl private implementation details |
| 8737 const int kHeaderSize = i::ScriptDataImpl::kHeaderSize; | 8737 const int kHeaderSize = i::PreparseDataConstants::kHeaderSize; |
| 8738 const int kFunctionEntrySize = i::FunctionEntry::kSize; | 8738 const int kFunctionEntrySize = i::FunctionEntry::kSize; |
| 8739 const int kFunctionEntryStartOffset = 0; | 8739 const int kFunctionEntryStartOffset = 0; |
| 8740 const int kFunctionEntryEndOffset = 1; | 8740 const int kFunctionEntryEndOffset = 1; |
| 8741 unsigned* sd_data = | 8741 unsigned* sd_data = |
| 8742 reinterpret_cast<unsigned*>(const_cast<char*>(sd->Data())); | 8742 reinterpret_cast<unsigned*>(const_cast<char*>(sd->Data())); |
| 8743 | 8743 |
| 8744 // Overwrite function bar's end position with 0. | 8744 // Overwrite function bar's end position with 0. |
| 8745 sd_data[kHeaderSize + 1 * kFunctionEntrySize + kFunctionEntryEndOffset] = 0; | 8745 sd_data[kHeaderSize + 1 * kFunctionEntrySize + kFunctionEntryEndOffset] = 0; |
| 8746 v8::TryCatch try_catch; | 8746 v8::TryCatch try_catch; |
| 8747 | 8747 |
| (...skipping 3019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11767 v8::Context::Scope context_scope(context.local()); | 11767 v8::Context::Scope context_scope(context.local()); |
| 11768 | 11768 |
| 11769 v8::Handle<v8::ObjectTemplate> tmpl = v8::ObjectTemplate::New(); | 11769 v8::Handle<v8::ObjectTemplate> tmpl = v8::ObjectTemplate::New(); |
| 11770 tmpl->SetNamedPropertyHandler(Getter, NULL, NULL, NULL, Enumerator); | 11770 tmpl->SetNamedPropertyHandler(Getter, NULL, NULL, NULL, Enumerator); |
| 11771 context->Global()->Set(v8_str("o"), tmpl->NewInstance()); | 11771 context->Global()->Set(v8_str("o"), tmpl->NewInstance()); |
| 11772 v8::Handle<v8::Array> result = v8::Handle<v8::Array>::Cast(CompileRun( | 11772 v8::Handle<v8::Array> result = v8::Handle<v8::Array>::Cast(CompileRun( |
| 11773 "var result = []; for (var k in o) result.push(k); result")); | 11773 "var result = []; for (var k in o) result.push(k); result")); |
| 11774 CHECK_EQ(1, result->Length()); | 11774 CHECK_EQ(1, result->Length()); |
| 11775 CHECK_EQ(v8_str("universalAnswer"), result->Get(0)); | 11775 CHECK_EQ(v8_str("universalAnswer"), result->Get(0)); |
| 11776 } | 11776 } |
| OLD | NEW |