OLD | NEW |
1 // Copyright 2012 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 |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "test/cctest/test-api.h" | 33 #include "test/cctest/test-api.h" |
34 | 34 |
35 #if V8_OS_POSIX | 35 #if V8_OS_POSIX |
36 #include <unistd.h> // NOLINT | 36 #include <unistd.h> // NOLINT |
37 #endif | 37 #endif |
38 | 38 |
39 #include "include/v8-util.h" | 39 #include "include/v8-util.h" |
40 #include "src/api.h" | 40 #include "src/api.h" |
41 #include "src/arguments.h" | 41 #include "src/arguments.h" |
42 #include "src/base/platform/platform.h" | 42 #include "src/base/platform/platform.h" |
| 43 #include "src/base/smart-pointers.h" |
43 #include "src/compilation-cache.h" | 44 #include "src/compilation-cache.h" |
44 #include "src/debug.h" | 45 #include "src/debug.h" |
45 #include "src/execution.h" | 46 #include "src/execution.h" |
46 #include "src/objects.h" | 47 #include "src/objects.h" |
47 #include "src/parser.h" | 48 #include "src/parser.h" |
48 #include "src/smart-pointers.h" | |
49 #include "src/unicode-inl.h" | 49 #include "src/unicode-inl.h" |
50 #include "src/utils.h" | 50 #include "src/utils.h" |
51 #include "src/vm-state.h" | 51 #include "src/vm-state.h" |
52 | 52 |
53 static const bool kLogThreading = false; | 53 static const bool kLogThreading = false; |
54 | 54 |
55 using ::v8::Boolean; | 55 using ::v8::Boolean; |
56 using ::v8::BooleanObject; | 56 using ::v8::BooleanObject; |
57 using ::v8::Context; | 57 using ::v8::Context; |
58 using ::v8::Extension; | 58 using ::v8::Extension; |
(...skipping 16650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16709 | 16709 |
16710 | 16710 |
16711 TEST(ContainsOnlyOneByte) { | 16711 TEST(ContainsOnlyOneByte) { |
16712 v8::V8::Initialize(); | 16712 v8::V8::Initialize(); |
16713 v8::Isolate* isolate = CcTest::isolate(); | 16713 v8::Isolate* isolate = CcTest::isolate(); |
16714 v8::HandleScope scope(isolate); | 16714 v8::HandleScope scope(isolate); |
16715 // Make a buffer long enough that it won't automatically be converted. | 16715 // Make a buffer long enough that it won't automatically be converted. |
16716 const int length = 512; | 16716 const int length = 512; |
16717 // Ensure word aligned assignment. | 16717 // Ensure word aligned assignment. |
16718 const int aligned_length = length*sizeof(uintptr_t)/sizeof(uint16_t); | 16718 const int aligned_length = length*sizeof(uintptr_t)/sizeof(uint16_t); |
16719 i::SmartArrayPointer<uintptr_t> | 16719 v8::base::SmartArrayPointer<uintptr_t> aligned_contents( |
16720 aligned_contents(new uintptr_t[aligned_length]); | 16720 new uintptr_t[aligned_length]); |
16721 uint16_t* string_contents = | 16721 uint16_t* string_contents = |
16722 reinterpret_cast<uint16_t*>(aligned_contents.get()); | 16722 reinterpret_cast<uint16_t*>(aligned_contents.get()); |
16723 // Set to contain only one byte. | 16723 // Set to contain only one byte. |
16724 for (int i = 0; i < length-1; i++) { | 16724 for (int i = 0; i < length-1; i++) { |
16725 string_contents[i] = 0x41; | 16725 string_contents[i] = 0x41; |
16726 } | 16726 } |
16727 string_contents[length-1] = 0; | 16727 string_contents[length-1] = 0; |
16728 // Simple case. | 16728 // Simple case. |
16729 Handle<String> string = | 16729 Handle<String> string = |
16730 String::NewExternal(isolate, | 16730 String::NewExternal(isolate, |
(...skipping 5117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21848 " fake.age;\n" | 21848 " fake.age;\n" |
21849 " result = 1;\n" | 21849 " result = 1;\n" |
21850 " } catch (e) {\n" | 21850 " } catch (e) {\n" |
21851 " }\n" | 21851 " }\n" |
21852 " test(d+1);\n" | 21852 " test(d+1);\n" |
21853 "}\n" | 21853 "}\n" |
21854 "test(0);\n" | 21854 "test(0);\n" |
21855 "result;\n", | 21855 "result;\n", |
21856 0); | 21856 0); |
21857 } | 21857 } |
OLD | NEW |