| OLD | NEW |
| 1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 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 7132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7143 CHECK_EQ(String::New(expected_cons), | 7143 CHECK_EQ(String::New(expected_cons), |
| 7144 env->Global()->Get(v8_str("cons"))); | 7144 env->Global()->Get(v8_str("cons"))); |
| 7145 CHECK_EQ(String::New(expected_slice), | 7145 CHECK_EQ(String::New(expected_slice), |
| 7146 env->Global()->Get(v8_str("slice"))); | 7146 env->Global()->Get(v8_str("slice"))); |
| 7147 CHECK_EQ(String::New(expected_slice_on_cons), | 7147 CHECK_EQ(String::New(expected_slice_on_cons), |
| 7148 env->Global()->Get(v8_str("slice_on_cons"))); | 7148 env->Global()->Get(v8_str("slice_on_cons"))); |
| 7149 } | 7149 } |
| 7150 } | 7150 } |
| 7151 | 7151 |
| 7152 | 7152 |
| 7153 TEST(CompileExternalTwoByteSource) { |
| 7154 v8::HandleScope scope; |
| 7155 LocalContext context; |
| 7156 |
| 7157 // This is a very short list of sources, which currently is to check for a |
| 7158 // regression caused by r2703. |
| 7159 const char* ascii_sources[] = { |
| 7160 "0.5", |
| 7161 "-0.5", // This mainly testes PushBack in the Scanner. |
| 7162 "--0.5", // This mainly testes PushBack in the Scanner. |
| 7163 NULL |
| 7164 }; |
| 7165 |
| 7166 // Compile the sources as external two byte strings. |
| 7167 for (int i = 0; ascii_sources[i] != NULL; i++) { |
| 7168 uint16_t* two_byte_string = AsciiToTwoByteString(ascii_sources[i]); |
| 7169 UC16VectorResource uc16_resource( |
| 7170 i::Vector<const uint16_t>(two_byte_string, strlen(ascii_sources[i]))); |
| 7171 v8::Local<v8::String> source = v8::String::NewExternal(&uc16_resource); |
| 7172 v8::Script::Compile(source); |
| 7173 } |
| 7174 } |
| 7175 |
| 7176 |
| 7153 class RegExpStringModificationTest { | 7177 class RegExpStringModificationTest { |
| 7154 public: | 7178 public: |
| 7155 RegExpStringModificationTest() | 7179 RegExpStringModificationTest() |
| 7156 : block_(i::OS::CreateSemaphore(0)), | 7180 : block_(i::OS::CreateSemaphore(0)), |
| 7157 morphs_(0), | 7181 morphs_(0), |
| 7158 morphs_during_regexp_(0), | 7182 morphs_during_regexp_(0), |
| 7159 ascii_resource_(i::Vector<const char>("aaaaaaaaaaaaaab", 15)), | 7183 ascii_resource_(i::Vector<const char>("aaaaaaaaaaaaaab", 15)), |
| 7160 uc16_resource_(i::Vector<const uint16_t>(two_byte_content_, 15)) {} | 7184 uc16_resource_(i::Vector<const uint16_t>(two_byte_content_, 15)) {} |
| 7161 ~RegExpStringModificationTest() { delete block_; } | 7185 ~RegExpStringModificationTest() { delete block_; } |
| 7162 void RunTest() { | 7186 void RunTest() { |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7788 LocalContext context; | 7812 LocalContext context; |
| 7789 v8::TryCatch try_catch; | 7813 v8::TryCatch try_catch; |
| 7790 const char *source = "function foo() { FAIL.FAIL; }; foo();"; | 7814 const char *source = "function foo() { FAIL.FAIL; }; foo();"; |
| 7791 v8::Handle<v8::String> src = v8::String::New(source); | 7815 v8::Handle<v8::String> src = v8::String::New(source); |
| 7792 v8::Handle<v8::String> origin = v8::String::New("stack-trace-test"); | 7816 v8::Handle<v8::String> origin = v8::String::New("stack-trace-test"); |
| 7793 v8::Script::New(src, origin)->Run(); | 7817 v8::Script::New(src, origin)->Run(); |
| 7794 CHECK(try_catch.HasCaught()); | 7818 CHECK(try_catch.HasCaught()); |
| 7795 v8::String::Utf8Value stack(try_catch.StackTrace()); | 7819 v8::String::Utf8Value stack(try_catch.StackTrace()); |
| 7796 CHECK(strstr(*stack, "at foo (stack-trace-test") != NULL); | 7820 CHECK(strstr(*stack, "at foo (stack-trace-test") != NULL); |
| 7797 } | 7821 } |
| OLD | NEW |