OLD | NEW |
1 // Copyright 2011 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 CHECK(error_preparse->HasError()); | 223 CHECK(error_preparse->HasError()); |
224 i::ScriptDataImpl *pre_impl = | 224 i::ScriptDataImpl *pre_impl = |
225 reinterpret_cast<i::ScriptDataImpl*>(error_preparse); | 225 reinterpret_cast<i::ScriptDataImpl*>(error_preparse); |
226 i::Scanner::Location error_location = | 226 i::Scanner::Location error_location = |
227 pre_impl->MessageLocation(); | 227 pre_impl->MessageLocation(); |
228 // Error is at "z" in source, location 10..11. | 228 // Error is at "z" in source, location 10..11. |
229 CHECK_EQ(10, error_location.beg_pos); | 229 CHECK_EQ(10, error_location.beg_pos); |
230 CHECK_EQ(11, error_location.end_pos); | 230 CHECK_EQ(11, error_location.end_pos); |
231 // Should not crash. | 231 // Should not crash. |
232 const char* message = pre_impl->BuildMessage(); | 232 const char* message = pre_impl->BuildMessage(); |
233 i::Vector<const char*> args(pre_impl->BuildArgs()); | 233 pre_impl->BuildArgs(); |
234 CHECK_GT(strlen(message), 0); | 234 CHECK_GT(strlen(message), 0); |
235 } | 235 } |
236 | 236 |
237 | 237 |
238 TEST(StandAlonePreParser) { | 238 TEST(StandAlonePreParser) { |
239 v8::V8::Initialize(); | 239 v8::V8::Initialize(); |
240 | 240 |
241 int marker; | 241 int marker; |
242 i::Isolate::Current()->stack_guard()->SetStackLimit( | 242 i::Isolate::Current()->stack_guard()->SetStackLimit( |
243 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024); | 243 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024); |
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1075 termination_data[k], | 1075 termination_data[k], |
1076 context_data[i][1]); | 1076 context_data[i][1]); |
1077 CHECK(length == kProgramSize); | 1077 CHECK(length == kProgramSize); |
1078 i::Handle<i::String> source = | 1078 i::Handle<i::String> source = |
1079 FACTORY->NewStringFromAscii(i::CStrVector(program.start())); | 1079 FACTORY->NewStringFromAscii(i::CStrVector(program.start())); |
1080 TestParserSyncWithFlags(source); | 1080 TestParserSyncWithFlags(source); |
1081 } | 1081 } |
1082 } | 1082 } |
1083 } | 1083 } |
1084 } | 1084 } |
OLD | NEW |