OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 SimpleTwoByteStringResource; | 56 SimpleTwoByteStringResource; |
57 | 57 |
58 | 58 |
59 const char* const ExternalizeStringExtension::kSource = | 59 const char* const ExternalizeStringExtension::kSource = |
60 "native function externalizeString();" | 60 "native function externalizeString();" |
61 "native function isAsciiString();"; | 61 "native function isAsciiString();"; |
62 | 62 |
63 | 63 |
64 v8::Handle<v8::FunctionTemplate> ExternalizeStringExtension::GetNativeFunction( | 64 v8::Handle<v8::FunctionTemplate> ExternalizeStringExtension::GetNativeFunction( |
65 v8::Handle<v8::String> str) { | 65 v8::Handle<v8::String> str) { |
66 if (strcmp(*v8::String::AsciiValue(str), "externalizeString") == 0) { | 66 if (strcmp(*v8::String::Utf8Value(str), "externalizeString") == 0) { |
67 return v8::FunctionTemplate::New(ExternalizeStringExtension::Externalize); | 67 return v8::FunctionTemplate::New(ExternalizeStringExtension::Externalize); |
68 } else { | 68 } else { |
69 ASSERT(strcmp(*v8::String::AsciiValue(str), "isAsciiString") == 0); | 69 ASSERT(strcmp(*v8::String::Utf8Value(str), "isAsciiString") == 0); |
70 return v8::FunctionTemplate::New(ExternalizeStringExtension::IsAscii); | 70 return v8::FunctionTemplate::New(ExternalizeStringExtension::IsAscii); |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
74 | 74 |
75 v8::Handle<v8::Value> ExternalizeStringExtension::Externalize( | 75 v8::Handle<v8::Value> ExternalizeStringExtension::Externalize( |
76 const v8::Arguments& args) { | 76 const v8::Arguments& args) { |
77 if (args.Length() < 1 || !args[0]->IsString()) { | 77 if (args.Length() < 1 || !args[0]->IsString()) { |
78 return v8::ThrowException(v8::String::New( | 78 return v8::ThrowException(v8::String::New( |
79 "First parameter to externalizeString() must be a string.")); | 79 "First parameter to externalizeString() must be a string.")); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 v8::True() : v8::False(); | 132 v8::True() : v8::False(); |
133 } | 133 } |
134 | 134 |
135 | 135 |
136 void ExternalizeStringExtension::Register() { | 136 void ExternalizeStringExtension::Register() { |
137 static ExternalizeStringExtension externalize_extension; | 137 static ExternalizeStringExtension externalize_extension; |
138 static v8::DeclareExtension declaration(&externalize_extension); | 138 static v8::DeclareExtension declaration(&externalize_extension); |
139 } | 139 } |
140 | 140 |
141 } } // namespace v8::internal | 141 } } // namespace v8::internal |
OLD | NEW |