Commit f3ea8f46 authored by Linshizhi's avatar Linshizhi

Add Encoder

parent 4ad6b5b6
......@@ -4314,6 +4314,7 @@ v8_source_set("v8_base_without_compiler") {
"src/builtins/builtins-internal.cc",
"src/builtins/builtins-intl.cc",
"src/builtins/builtins-json.cc",
"src/builtins/builtins-encoder.cc",
"src/builtins/builtins-number.cc",
"src/builtins/builtins-object.cc",
"src/builtins/builtins-reflect.cc",
......
This diff is collapsed.
#include <stdio.h>
#include "src/builtins/builtins.h"
#include "src/builtins/builtins-utils-inl.h"
namespace v8 {
namespace internal {
BUILTIN(Encode) {
HandleScope scope(isolate);
printf("Encoding...\n");
return *isolate->factory()->ToBoolean(true);
}
} // internal
} // v8
......@@ -2786,6 +2786,15 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
InstallToStringTag(isolate_, json_object, "JSON");
}
{
Handle<JSObject> encoder =
factory->NewJSObject(isolate_->object_function(), AllocationType::kOld);
JSObject::AddProperty(isolate_, global, "ENCODER", encoder, DONT_ENUM);
SimpleInstallFunction(isolate_, encoder, "encode",
Builtin::kEncode, 0, true);
InstallToStringTag(isolate_, encoder, "ENCODER");
}
{ // -- M a t h
Handle<JSObject> math =
factory->NewJSObject(isolate_->object_function(), AllocationType::kOld);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment