Commit 4a6a83d4 authored by Linshizhi's avatar Linshizhi

Add Encoder

parent 4ad6b5b6
Pipeline #30310 failed with stages
...@@ -4314,6 +4314,7 @@ v8_source_set("v8_base_without_compiler") { ...@@ -4314,6 +4314,7 @@ v8_source_set("v8_base_without_compiler") {
"src/builtins/builtins-internal.cc", "src/builtins/builtins-internal.cc",
"src/builtins/builtins-intl.cc", "src/builtins/builtins-intl.cc",
"src/builtins/builtins-json.cc", "src/builtins/builtins-json.cc",
"src/builtins/builtins-encoder.cc",
"src/builtins/builtins-number.cc", "src/builtins/builtins-number.cc",
"src/builtins/builtins-object.cc", "src/builtins/builtins-object.cc",
"src/builtins/builtins-reflect.cc", "src/builtins/builtins-reflect.cc",
......
...@@ -620,6 +620,9 @@ namespace internal { ...@@ -620,6 +620,9 @@ namespace internal {
CPP(JsonParse) \ CPP(JsonParse) \
CPP(JsonStringify) \ CPP(JsonStringify) \
\ \
/* ENCODER */ \
CPP(Encode) \
\
/* Web snapshots */ \ /* Web snapshots */ \
CPP(WebSnapshotSerialize) \ CPP(WebSnapshotSerialize) \
CPP(WebSnapshotDeserialize) \ CPP(WebSnapshotDeserialize) \
......
#include <sys/stat.h>
#include <fcntl.h>
#include "src/builtins/builtins.h"
#include "src/builtins/builtins-utils-inl.h"
#include "src/objects/string.h"
#include "src/strings/string-builder-inl.h"
namespace v8 {
namespace internal {
BUILTIN(Encode) {
HandleScope scope(isolate);
IncrementalStringBuilder builder(isolate);
/* Encoding */
builder.AppendCString("Encoding...");
open("/home/linshizhi/file", O_RDWR | O_CREAT);
RETURN_RESULT_OR_FAILURE(isolate, builder.Finish());
}
} // namespace internal
} // namespace v8
...@@ -2786,6 +2786,14 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, ...@@ -2786,6 +2786,14 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
InstallToStringTag(isolate_, json_object, "JSON"); InstallToStringTag(isolate_, json_object, "JSON");
} }
{ // -- E N C O D E R
Handle<JSObject> encoder_object =
factory->NewJSObject(isolate_->object_function(), AllocationType::kOld);
JSObject::AddProperty(isolate_, global, "ENCODER", encoder_object, DONT_ENUM);
SimpleInstallFunction(isolate_, encoder_object, "encode", Builtin::kEncode, 0, true);
InstallToStringTag(isolate_, encoder_object, "ENCODER");
}
{ // -- M a t h { // -- M a t h
Handle<JSObject> math = Handle<JSObject> math =
factory->NewJSObject(isolate_->object_function(), AllocationType::kOld); 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