| Index: test/cctest/print-extension.cc
|
| diff --git a/src/extensions/free-buffer-extension.cc b/test/cctest/print-extension.cc
|
| similarity index 73%
|
| copy from src/extensions/free-buffer-extension.cc
|
| copy to test/cctest/print-extension.cc
|
| index b4abaafe237aec39a0a1183cd20f244fd0eca5e8..9f629195bd7909c1a97760484cea37b600461b98 100644
|
| --- a/src/extensions/free-buffer-extension.cc
|
| +++ b/test/cctest/print-extension.cc
|
| @@ -1,4 +1,4 @@
|
| -// Copyright 2013 the V8 project authors. All rights reserved.
|
| +// Copyright 2014 the V8 project authors. All rights reserved.
|
| // Redistribution and use in source and binary forms, with or without
|
| // modification, are permitted provided that the following conditions are
|
| // met:
|
| @@ -25,26 +25,27 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -#include "free-buffer-extension.h"
|
| -#include "platform.h"
|
| -#include "v8.h"
|
| +#include "print-extension.h"
|
|
|
| namespace v8 {
|
| namespace internal {
|
|
|
| -
|
| -v8::Handle<v8::FunctionTemplate> FreeBufferExtension::GetNativeFunctionTemplate(
|
| +v8::Handle<v8::FunctionTemplate> PrintExtension::GetNativeFunctionTemplate(
|
| v8::Isolate* isolate,
|
| v8::Handle<v8::String> str) {
|
| - return v8::FunctionTemplate::New(isolate, FreeBufferExtension::FreeBuffer);
|
| + return v8::FunctionTemplate::New(isolate, PrintExtension::Print);
|
| }
|
|
|
|
|
| -void FreeBufferExtension::FreeBuffer(
|
| - const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| - v8::Handle<v8::ArrayBuffer> arrayBuffer = args[0].As<v8::ArrayBuffer>();
|
| - v8::ArrayBuffer::Contents contents = arrayBuffer->Externalize();
|
| - V8::ArrayBufferAllocator()->Free(contents.Data(), contents.ByteLength());
|
| +void PrintExtension::Print(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| + for (int i = 0; i < args.Length(); i++) {
|
| + if (i != 0) printf(" ");
|
| + v8::HandleScope scope(args.GetIsolate());
|
| + v8::String::Utf8Value str(args[i]);
|
| + if (*str == NULL) return;
|
| + printf("%s", *str);
|
| + }
|
| + printf("\n");
|
| }
|
|
|
| } } // namespace v8::internal
|
|
|