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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 v8::Handle<v8::FunctionTemplate> | 63 v8::Handle<v8::FunctionTemplate> |
64 ExternalizeStringExtension::GetNativeFunctionTemplate( | 64 ExternalizeStringExtension::GetNativeFunctionTemplate( |
65 v8::Isolate* isolate, v8::Handle<v8::String> str) { | 65 v8::Isolate* isolate, v8::Handle<v8::String> str) { |
66 if (strcmp(*v8::String::Utf8Value(str), "externalizeString") == 0) { | 66 if (strcmp(*v8::String::Utf8Value(str), "externalizeString") == 0) { |
67 return v8::FunctionTemplate::New(ExternalizeStringExtension::Externalize); | 67 return v8::FunctionTemplate::New(isolate, |
| 68 ExternalizeStringExtension::Externalize); |
68 } else { | 69 } else { |
69 ASSERT(strcmp(*v8::String::Utf8Value(str), "isAsciiString") == 0); | 70 ASSERT(strcmp(*v8::String::Utf8Value(str), "isAsciiString") == 0); |
70 return v8::FunctionTemplate::New(ExternalizeStringExtension::IsAscii); | 71 return v8::FunctionTemplate::New(isolate, |
| 72 ExternalizeStringExtension::IsAscii); |
71 } | 73 } |
72 } | 74 } |
73 | 75 |
74 | 76 |
75 void ExternalizeStringExtension::Externalize( | 77 void ExternalizeStringExtension::Externalize( |
76 const v8::FunctionCallbackInfo<v8::Value>& args) { | 78 const v8::FunctionCallbackInfo<v8::Value>& args) { |
77 if (args.Length() < 1 || !args[0]->IsString()) { | 79 if (args.Length() < 1 || !args[0]->IsString()) { |
78 args.GetIsolate()->ThrowException(v8::String::NewFromUtf8( | 80 args.GetIsolate()->ThrowException(v8::String::NewFromUtf8( |
79 args.GetIsolate(), | 81 args.GetIsolate(), |
80 "First parameter to externalizeString() must be a string.")); | 82 "First parameter to externalizeString() must be a string.")); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 args.GetReturnValue().Set(is_one_byte); | 145 args.GetReturnValue().Set(is_one_byte); |
144 } | 146 } |
145 | 147 |
146 | 148 |
147 void ExternalizeStringExtension::Register() { | 149 void ExternalizeStringExtension::Register() { |
148 static ExternalizeStringExtension externalize_extension; | 150 static ExternalizeStringExtension externalize_extension; |
149 static v8::DeclareExtension declaration(&externalize_extension); | 151 static v8::DeclareExtension declaration(&externalize_extension); |
150 } | 152 } |
151 | 153 |
152 } } // namespace v8::internal | 154 } } // namespace v8::internal |
OLD | NEW |