Commit e461e1c6 authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[presubmit] Enable and fix "build/namespaces" linter check.

R=clemensh@chromium.org

Change-Id: I42241713b7d14dd1cb321df0570566b0873c10a4
Reviewed-on: https://chromium-review.googlesource.com/647888Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47793}
parent 36b50283
......@@ -9,53 +9,53 @@
#include "include/libplatform/libplatform.h"
#include "include/v8.h"
using namespace v8;
int main(int argc, char* argv[]) {
// Initialize V8.
V8::InitializeICUDefaultLocation(argv[0]);
V8::InitializeExternalStartupData(argv[0]);
Platform* platform = platform::CreateDefaultPlatform();
V8::InitializePlatform(platform);
V8::Initialize();
v8::V8::InitializeICUDefaultLocation(argv[0]);
v8::V8::InitializeExternalStartupData(argv[0]);
v8::Platform* platform = v8::platform::CreateDefaultPlatform();
v8::V8::InitializePlatform(platform);
v8::V8::Initialize();
// Create a new Isolate and make it the current one.
Isolate::CreateParams create_params;
v8::Isolate::CreateParams create_params;
create_params.array_buffer_allocator =
v8::ArrayBuffer::Allocator::NewDefaultAllocator();
Isolate* isolate = Isolate::New(create_params);
v8::Isolate* isolate = v8::Isolate::New(create_params);
{
Isolate::Scope isolate_scope(isolate);
v8::Isolate::Scope isolate_scope(isolate);
// Create a stack-allocated handle scope.
HandleScope handle_scope(isolate);
v8::HandleScope handle_scope(isolate);
// Create a new context.
Local<Context> context = Context::New(isolate);
v8::Local<v8::Context> context = v8::Context::New(isolate);
// Enter the context for compiling and running the hello world script.
Context::Scope context_scope(context);
v8::Context::Scope context_scope(context);
// Create a string containing the JavaScript source code.
Local<String> source =
String::NewFromUtf8(isolate, "'Hello' + ', World!'",
NewStringType::kNormal).ToLocalChecked();
v8::Local<v8::String> source =
v8::String::NewFromUtf8(isolate, "'Hello' + ', World!'",
v8::NewStringType::kNormal)
.ToLocalChecked();
// Compile the source code.
Local<Script> script = Script::Compile(context, source).ToLocalChecked();
v8::Local<v8::Script> script =
v8::Script::Compile(context, source).ToLocalChecked();
// Run the script to get the result.
Local<Value> result = script->Run(context).ToLocalChecked();
v8::Local<v8::Value> result = script->Run(context).ToLocalChecked();
// Convert the result to an UTF8 string and print it.
String::Utf8Value utf8(isolate, result);
v8::String::Utf8Value utf8(isolate, result);
printf("%s\n", *utf8);
}
// Dispose the isolate and tear down V8.
isolate->Dispose();
V8::Dispose();
V8::ShutdownPlatform();
v8::V8::Dispose();
v8::V8::ShutdownPlatform();
delete platform;
delete create_params.array_buffer_allocator;
return 0;
......
......@@ -35,8 +35,30 @@
#include <map>
#include <string>
using namespace std;
using namespace v8;
using std::map;
using std::pair;
using std::string;
using v8::Context;
using v8::EscapableHandleScope;
using v8::External;
using v8::Function;
using v8::FunctionTemplate;
using v8::Global;
using v8::HandleScope;
using v8::Isolate;
using v8::Local;
using v8::MaybeLocal;
using v8::Name;
using v8::NamedPropertyHandlerConfiguration;
using v8::NewStringType;
using v8::Object;
using v8::ObjectTemplate;
using v8::PropertyCallbackInfo;
using v8::Script;
using v8::String;
using v8::TryCatch;
using v8::Value;
// These interfaces represent an existing request processing interface.
// The idea is to imagine a real application that uses these interfaces
......
......@@ -11,10 +11,8 @@
namespace v8 {
namespace internal {
namespace {
// White list for objects that for sure only contain data.
bool ContainsOnlyData(VisitorId visitor_id) {
bool Scavenger::ContainsOnlyData(VisitorId visitor_id) {
switch (visitor_id) {
case kVisitSeqOneByteString:
return true;
......@@ -32,8 +30,6 @@ bool ContainsOnlyData(VisitorId visitor_id) {
return false;
}
} // namespace
void Scavenger::PageMemoryFence(Object* object) {
#ifdef THREAD_SANITIZER
// Perform a dummy acquire load to tell TSAN that there is no data race
......
......@@ -93,6 +93,8 @@ class Scavenger {
void RecordCopiedObject(HeapObject* obj);
static inline bool ContainsOnlyData(VisitorId visitor_id);
Heap* const heap_;
PromotionList::View promotion_list_;
CopiedList::View copied_list_;
......
......@@ -68,6 +68,8 @@ std::string InterpreterTester::function_name() {
return std::string(kFunctionName);
}
const char InterpreterTester::kFunctionName[] = "f";
} // namespace interpreter
} // namespace internal
} // namespace v8
......@@ -46,10 +46,6 @@ class InterpreterCallable {
Handle<JSFunction> function_;
};
namespace {
const char kFunctionName[] = "f";
} // namespace
class InterpreterTester {
public:
InterpreterTester(Isolate* isolate, const char* source,
......@@ -82,6 +78,8 @@ class InterpreterTester {
static std::string function_name();
static const char kFunctionName[];
private:
Isolate* isolate_;
const char* source_;
......
......@@ -1505,27 +1505,28 @@ static void CheckCanonicalEquivalence(uint16_t c, uint16_t test) {
TEST(Latin1IgnoreCase) {
using namespace unibrow;
for (uint16_t c = Latin1::kMaxChar + 1; c != 0; c++) {
uint16_t lower = ConvertLatin1<ToLowercase, false>(c);
uint16_t upper = ConvertLatin1<ToUppercase, false>(c);
uint16_t test = Latin1::ConvertNonLatin1ToLatin1(c);
for (uint16_t c = unibrow::Latin1::kMaxChar + 1; c != 0; c++) {
uint16_t lower = ConvertLatin1<unibrow::ToLowercase, false>(c);
uint16_t upper = ConvertLatin1<unibrow::ToUppercase, false>(c);
uint16_t test = unibrow::Latin1::ConvertNonLatin1ToLatin1(c);
// Filter out all character whose upper is not their lower or vice versa.
if (lower == 0 && upper == 0) {
CheckCanonicalEquivalence(c, test);
continue;
}
if (lower > Latin1::kMaxChar && upper > Latin1::kMaxChar) {
if (lower > unibrow::Latin1::kMaxChar &&
upper > unibrow::Latin1::kMaxChar) {
CheckCanonicalEquivalence(c, test);
continue;
}
if (lower == 0 && upper != 0) {
lower = ConvertLatin1<ToLowercase, false>(upper);
lower = ConvertLatin1<unibrow::ToLowercase, false>(upper);
}
if (upper == 0 && lower != c) {
upper = ConvertLatin1<ToUppercase, false>(lower);
upper = ConvertLatin1<unibrow::ToUppercase, false>(lower);
}
if (lower > Latin1::kMaxChar && upper > Latin1::kMaxChar) {
if (lower > unibrow::Latin1::kMaxChar &&
upper > unibrow::Latin1::kMaxChar) {
CheckCanonicalEquivalence(c, test);
continue;
}
......
......@@ -60,7 +60,6 @@ from testrunner.local import utils
LINT_RULES = """
-build/header_guard
-build/include_what_you_use
-build/namespaces
-readability/check
-readability/fn_size
+readability/streams
......
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