mirror of https://github.com/lukechilds/node.git
Browse Source
PR-URL: https://github.com/nodejs/node/pull/9618 Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>v6
Michaël Zasso
8 years ago
1522 changed files with 117699 additions and 60038 deletions
File diff suppressed because it is too large
@ -1,77 +0,0 @@ |
|||||
# Copyright 2015 the V8 project authors. All rights reserved. |
|
||||
# Copyright 2015 The Chromium Authors. All rights reserved. |
|
||||
# Use of this source code is governed by a BSD-style license that can be |
|
||||
# found in the LICENSE file. |
|
||||
{ |
|
||||
'conditions': [ |
|
||||
# Copy the VS runtime DLLs into the isolate so that they |
|
||||
# don't have to be preinstalled on the target machine. |
|
||||
# |
|
||||
# VS2013 runtimes |
|
||||
['OS=="win" and msvs_version==2013 and component=="shared_library" and CONFIGURATION_NAME=="Debug"', { |
|
||||
'variables': { |
|
||||
'files': [ |
|
||||
'<(PRODUCT_DIR)/x64/msvcp120d.dll', |
|
||||
'<(PRODUCT_DIR)/x64/msvcr120d.dll', |
|
||||
], |
|
||||
}, |
|
||||
}], |
|
||||
['OS=="win" and msvs_version==2013 and component=="shared_library" and CONFIGURATION_NAME=="Release"', { |
|
||||
'variables': { |
|
||||
'files': [ |
|
||||
'<(PRODUCT_DIR)/x64/msvcp120.dll', |
|
||||
'<(PRODUCT_DIR)/x64/msvcr120.dll', |
|
||||
], |
|
||||
}, |
|
||||
}], |
|
||||
['OS=="win" and msvs_version==2013 and component=="shared_library" and (CONFIGURATION_NAME=="Debug" or CONFIGURATION_NAME=="Debug_x64")', { |
|
||||
'variables': { |
|
||||
'files': [ |
|
||||
'<(PRODUCT_DIR)/msvcp120d.dll', |
|
||||
'<(PRODUCT_DIR)/msvcr120d.dll', |
|
||||
], |
|
||||
}, |
|
||||
}], |
|
||||
['OS=="win" and msvs_version==2013 and component=="shared_library" and (CONFIGURATION_NAME=="Release" or CONFIGURATION_NAME=="Release_x64")', { |
|
||||
'variables': { |
|
||||
'files': [ |
|
||||
'<(PRODUCT_DIR)/msvcp120.dll', |
|
||||
'<(PRODUCT_DIR)/msvcr120.dll', |
|
||||
], |
|
||||
}, |
|
||||
}], |
|
||||
# VS2015 runtimes |
|
||||
['OS=="win" and msvs_version==2015 and component=="shared_library" and CONFIGURATION_NAME=="Debug"', { |
|
||||
'variables': { |
|
||||
'files': [ |
|
||||
'<(PRODUCT_DIR)/x64/msvcp140d.dll', |
|
||||
'<(PRODUCT_DIR)/x64/vccorlib140d.dll', |
|
||||
], |
|
||||
}, |
|
||||
}], |
|
||||
['OS=="win" and msvs_version==2015 and component=="shared_library" and CONFIGURATION_NAME=="Release"', { |
|
||||
'variables': { |
|
||||
'files': [ |
|
||||
'<(PRODUCT_DIR)/x64/msvcp140.dll', |
|
||||
'<(PRODUCT_DIR)/x64/vccorlib140.dll', |
|
||||
], |
|
||||
}, |
|
||||
}], |
|
||||
['OS=="win" and msvs_version==2015 and component=="shared_library" and (CONFIGURATION_NAME=="Debug" or CONFIGURATION_NAME=="Debug_x64")', { |
|
||||
'variables': { |
|
||||
'files': [ |
|
||||
'<(PRODUCT_DIR)/msvcp140d.dll', |
|
||||
'<(PRODUCT_DIR)/vccorlib140d.dll', |
|
||||
], |
|
||||
}, |
|
||||
}], |
|
||||
['OS=="win" and msvs_version==2015 and component=="shared_library" and (CONFIGURATION_NAME=="Release" or CONFIGURATION_NAME=="Release_x64")', { |
|
||||
'variables': { |
|
||||
'files': [ |
|
||||
'<(PRODUCT_DIR)/msvcp140.dll', |
|
||||
'<(PRODUCT_DIR)/vccorlib140.dll', |
|
||||
], |
|
||||
}, |
|
||||
}], |
|
||||
], |
|
||||
} |
|
@ -0,0 +1,4 @@ |
|||||
|
include_rules = [ |
||||
|
# v8-inspector-protocol.h depends on generated files under include/inspector. |
||||
|
"+inspector", |
||||
|
] |
@ -1,2 +1,7 @@ |
|||||
danno@chromium.org |
danno@chromium.org |
||||
jochen@chromium.org |
jochen@chromium.org |
||||
|
|
||||
|
per-file v8-inspector.h=dgozman@chromium.org |
||||
|
per-file v8-inspector.h=pfeldman@chromium.org |
||||
|
per-file v8-inspector-protocol.h=dgozman@chromium.org |
||||
|
per-file v8-inspector-protocol.h=pfeldman@chromium.org |
||||
|
@ -0,0 +1,13 @@ |
|||||
|
// Copyright 2016 the V8 project authors. All rights reserved.
|
||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||
|
// found in the LICENSE file.
|
||||
|
|
||||
|
#ifndef V8_V8_INSPECTOR_PROTOCOL_H_ |
||||
|
#define V8_V8_INSPECTOR_PROTOCOL_H_ |
||||
|
|
||||
|
#include "inspector/Debugger.h" // NOLINT(build/include) |
||||
|
#include "inspector/Runtime.h" // NOLINT(build/include) |
||||
|
#include "inspector/Schema.h" // NOLINT(build/include) |
||||
|
#include "v8-inspector.h" // NOLINT(build/include) |
||||
|
|
||||
|
#endif // V8_V8_INSPECTOR_PROTOCOL_H_
|
@ -0,0 +1,267 @@ |
|||||
|
// Copyright 2016 the V8 project authors. All rights reserved.
|
||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||
|
// found in the LICENSE file.
|
||||
|
|
||||
|
#ifndef V8_V8_INSPECTOR_H_ |
||||
|
#define V8_V8_INSPECTOR_H_ |
||||
|
|
||||
|
#include <stdint.h> |
||||
|
#include <cctype> |
||||
|
|
||||
|
#include <memory> |
||||
|
|
||||
|
#include "v8.h" // NOLINT(build/include) |
||||
|
|
||||
|
namespace v8_inspector { |
||||
|
|
||||
|
namespace protocol { |
||||
|
namespace Debugger { |
||||
|
namespace API { |
||||
|
class SearchMatch; |
||||
|
} |
||||
|
} |
||||
|
namespace Runtime { |
||||
|
namespace API { |
||||
|
class RemoteObject; |
||||
|
class StackTrace; |
||||
|
} |
||||
|
} |
||||
|
namespace Schema { |
||||
|
namespace API { |
||||
|
class Domain; |
||||
|
} |
||||
|
} |
||||
|
} // namespace protocol
|
||||
|
|
||||
|
class V8_EXPORT StringView { |
||||
|
public: |
||||
|
StringView() : m_is8Bit(true), m_length(0), m_characters8(nullptr) {} |
||||
|
|
||||
|
StringView(const uint8_t* characters, size_t length) |
||||
|
: m_is8Bit(true), m_length(length), m_characters8(characters) {} |
||||
|
|
||||
|
StringView(const uint16_t* characters, size_t length) |
||||
|
: m_is8Bit(false), m_length(length), m_characters16(characters) {} |
||||
|
|
||||
|
bool is8Bit() const { return m_is8Bit; } |
||||
|
size_t length() const { return m_length; } |
||||
|
|
||||
|
// TODO(dgozman): add DCHECK(m_is8Bit) to accessors once platform can be used
|
||||
|
// here.
|
||||
|
const uint8_t* characters8() const { return m_characters8; } |
||||
|
const uint16_t* characters16() const { return m_characters16; } |
||||
|
|
||||
|
private: |
||||
|
bool m_is8Bit; |
||||
|
size_t m_length; |
||||
|
union { |
||||
|
const uint8_t* m_characters8; |
||||
|
const uint16_t* m_characters16; |
||||
|
}; |
||||
|
}; |
||||
|
|
||||
|
class V8_EXPORT StringBuffer { |
||||
|
public: |
||||
|
virtual ~StringBuffer() {} |
||||
|
virtual const StringView& string() = 0; |
||||
|
// This method copies contents.
|
||||
|
static std::unique_ptr<StringBuffer> create(const StringView&); |
||||
|
}; |
||||
|
|
||||
|
class V8_EXPORT V8ContextInfo { |
||||
|
public: |
||||
|
V8ContextInfo(v8::Local<v8::Context> context, int contextGroupId, |
||||
|
const StringView& humanReadableName) |
||||
|
: context(context), |
||||
|
contextGroupId(contextGroupId), |
||||
|
humanReadableName(humanReadableName), |
||||
|
hasMemoryOnConsole(false) {} |
||||
|
|
||||
|
v8::Local<v8::Context> context; |
||||
|
// Each v8::Context is a part of a group. The group id must be non-zero.
|
||||
|
int contextGroupId; |
||||
|
StringView humanReadableName; |
||||
|
StringView origin; |
||||
|
StringView auxData; |
||||
|
bool hasMemoryOnConsole; |
||||
|
|
||||
|
private: |
||||
|
// Disallow copying and allocating this one.
|
||||
|
enum NotNullTagEnum { NotNullLiteral }; |
||||
|
void* operator new(size_t) = delete; |
||||
|
void* operator new(size_t, NotNullTagEnum, void*) = delete; |
||||
|
void* operator new(size_t, void*) = delete; |
||||
|
V8ContextInfo(const V8ContextInfo&) = delete; |
||||
|
V8ContextInfo& operator=(const V8ContextInfo&) = delete; |
||||
|
}; |
||||
|
|
||||
|
class V8_EXPORT V8StackTrace { |
||||
|
public: |
||||
|
virtual bool isEmpty() const = 0; |
||||
|
virtual StringView topSourceURL() const = 0; |
||||
|
virtual int topLineNumber() const = 0; |
||||
|
virtual int topColumnNumber() const = 0; |
||||
|
virtual StringView topScriptId() const = 0; |
||||
|
virtual StringView topFunctionName() const = 0; |
||||
|
|
||||
|
virtual ~V8StackTrace() {} |
||||
|
virtual std::unique_ptr<protocol::Runtime::API::StackTrace> |
||||
|
buildInspectorObject() const = 0; |
||||
|
virtual std::unique_ptr<StringBuffer> toString() const = 0; |
||||
|
|
||||
|
// Safe to pass between threads, drops async chain.
|
||||
|
virtual std::unique_ptr<V8StackTrace> clone() = 0; |
||||
|
}; |
||||
|
|
||||
|
class V8_EXPORT V8InspectorSession { |
||||
|
public: |
||||
|
virtual ~V8InspectorSession() {} |
||||
|
|
||||
|
// Cross-context inspectable values (DOM nodes in different worlds, etc.).
|
||||
|
class V8_EXPORT Inspectable { |
||||
|
public: |
||||
|
virtual v8::Local<v8::Value> get(v8::Local<v8::Context>) = 0; |
||||
|
virtual ~Inspectable() {} |
||||
|
}; |
||||
|
virtual void addInspectedObject(std::unique_ptr<Inspectable>) = 0; |
||||
|
|
||||
|
// Dispatching protocol messages.
|
||||
|
static bool canDispatchMethod(const StringView& method); |
||||
|
virtual void dispatchProtocolMessage(const StringView& message) = 0; |
||||
|
virtual std::unique_ptr<StringBuffer> stateJSON() = 0; |
||||
|
virtual std::vector<std::unique_ptr<protocol::Schema::API::Domain>> |
||||
|
supportedDomains() = 0; |
||||
|
|
||||
|
// Debugger actions.
|
||||
|
virtual void schedulePauseOnNextStatement(const StringView& breakReason, |
||||
|
const StringView& breakDetails) = 0; |
||||
|
virtual void cancelPauseOnNextStatement() = 0; |
||||
|
virtual void breakProgram(const StringView& breakReason, |
||||
|
const StringView& breakDetails) = 0; |
||||
|
virtual void setSkipAllPauses(bool) = 0; |
||||
|
virtual void resume() = 0; |
||||
|
virtual void stepOver() = 0; |
||||
|
virtual std::vector<std::unique_ptr<protocol::Debugger::API::SearchMatch>> |
||||
|
searchInTextByLines(const StringView& text, const StringView& query, |
||||
|
bool caseSensitive, bool isRegex) = 0; |
||||
|
|
||||
|
// Remote objects.
|
||||
|
virtual std::unique_ptr<protocol::Runtime::API::RemoteObject> wrapObject( |
||||
|
v8::Local<v8::Context>, v8::Local<v8::Value>, |
||||
|
const StringView& groupName) = 0; |
||||
|
virtual bool unwrapObject(std::unique_ptr<StringBuffer>* error, |
||||
|
const StringView& objectId, v8::Local<v8::Value>*, |
||||
|
v8::Local<v8::Context>*, |
||||
|
std::unique_ptr<StringBuffer>* objectGroup) = 0; |
||||
|
virtual void releaseObjectGroup(const StringView&) = 0; |
||||
|
}; |
||||
|
|
||||
|
enum class V8ConsoleAPIType { kClear, kDebug, kLog, kInfo, kWarning, kError }; |
||||
|
|
||||
|
class V8_EXPORT V8InspectorClient { |
||||
|
public: |
||||
|
virtual ~V8InspectorClient() {} |
||||
|
|
||||
|
virtual void runMessageLoopOnPause(int contextGroupId) {} |
||||
|
virtual void quitMessageLoopOnPause() {} |
||||
|
virtual void runIfWaitingForDebugger(int contextGroupId) {} |
||||
|
|
||||
|
virtual void muteMetrics(int contextGroupId) {} |
||||
|
virtual void unmuteMetrics(int contextGroupId) {} |
||||
|
|
||||
|
virtual void beginUserGesture() {} |
||||
|
virtual void endUserGesture() {} |
||||
|
|
||||
|
virtual std::unique_ptr<StringBuffer> valueSubtype(v8::Local<v8::Value>) { |
||||
|
return nullptr; |
||||
|
} |
||||
|
virtual bool formatAccessorsAsProperties(v8::Local<v8::Value>) { |
||||
|
return false; |
||||
|
} |
||||
|
virtual bool isInspectableHeapObject(v8::Local<v8::Object>) { return true; } |
||||
|
|
||||
|
virtual v8::Local<v8::Context> ensureDefaultContextInGroup( |
||||
|
int contextGroupId) { |
||||
|
return v8::Local<v8::Context>(); |
||||
|
} |
||||
|
virtual void beginEnsureAllContextsInGroup(int contextGroupId) {} |
||||
|
virtual void endEnsureAllContextsInGroup(int contextGroupId) {} |
||||
|
|
||||
|
virtual void installAdditionalCommandLineAPI(v8::Local<v8::Context>, |
||||
|
v8::Local<v8::Object>) {} |
||||
|
virtual void consoleAPIMessage(int contextGroupId, V8ConsoleAPIType, |
||||
|
const StringView& message, |
||||
|
const StringView& url, unsigned lineNumber, |
||||
|
unsigned columnNumber, V8StackTrace*) {} |
||||
|
virtual v8::MaybeLocal<v8::Value> memoryInfo(v8::Isolate*, |
||||
|
v8::Local<v8::Context>) { |
||||
|
return v8::MaybeLocal<v8::Value>(); |
||||
|
} |
||||
|
|
||||
|
virtual void consoleTime(const StringView& title) {} |
||||
|
virtual void consoleTimeEnd(const StringView& title) {} |
||||
|
virtual void consoleTimeStamp(const StringView& title) {} |
||||
|
virtual double currentTimeMS() { return 0; } |
||||
|
typedef void (*TimerCallback)(void*); |
||||
|
virtual void startRepeatingTimer(double, TimerCallback, void* data) {} |
||||
|
virtual void cancelTimer(void* data) {} |
||||
|
|
||||
|
// TODO(dgozman): this was added to support service worker shadow page. We
|
||||
|
// should not connect at all.
|
||||
|
virtual bool canExecuteScripts(int contextGroupId) { return true; } |
||||
|
}; |
||||
|
|
||||
|
class V8_EXPORT V8Inspector { |
||||
|
public: |
||||
|
static std::unique_ptr<V8Inspector> create(v8::Isolate*, V8InspectorClient*); |
||||
|
virtual ~V8Inspector() {} |
||||
|
|
||||
|
// Contexts instrumentation.
|
||||
|
virtual void contextCreated(const V8ContextInfo&) = 0; |
||||
|
virtual void contextDestroyed(v8::Local<v8::Context>) = 0; |
||||
|
virtual void resetContextGroup(int contextGroupId) = 0; |
||||
|
|
||||
|
// Various instrumentation.
|
||||
|
virtual void willExecuteScript(v8::Local<v8::Context>, int scriptId) = 0; |
||||
|
virtual void didExecuteScript(v8::Local<v8::Context>) = 0; |
||||
|
virtual void idleStarted() = 0; |
||||
|
virtual void idleFinished() = 0; |
||||
|
|
||||
|
// Async stack traces instrumentation.
|
||||
|
virtual void asyncTaskScheduled(const StringView& taskName, void* task, |
||||
|
bool recurring) = 0; |
||||
|
virtual void asyncTaskCanceled(void* task) = 0; |
||||
|
virtual void asyncTaskStarted(void* task) = 0; |
||||
|
virtual void asyncTaskFinished(void* task) = 0; |
||||
|
virtual void allAsyncTasksCanceled() = 0; |
||||
|
|
||||
|
// Exceptions instrumentation.
|
||||
|
virtual unsigned exceptionThrown( |
||||
|
v8::Local<v8::Context>, const StringView& message, |
||||
|
v8::Local<v8::Value> exception, const StringView& detailedMessage, |
||||
|
const StringView& url, unsigned lineNumber, unsigned columnNumber, |
||||
|
std::unique_ptr<V8StackTrace>, int scriptId) = 0; |
||||
|
virtual void exceptionRevoked(v8::Local<v8::Context>, unsigned exceptionId, |
||||
|
const StringView& message) = 0; |
||||
|
|
||||
|
// Connection.
|
||||
|
class V8_EXPORT Channel { |
||||
|
public: |
||||
|
virtual ~Channel() {} |
||||
|
virtual void sendProtocolResponse(int callId, |
||||
|
const StringView& message) = 0; |
||||
|
virtual void sendProtocolNotification(const StringView& message) = 0; |
||||
|
virtual void flushProtocolNotifications() = 0; |
||||
|
}; |
||||
|
virtual std::unique_ptr<V8InspectorSession> connect( |
||||
|
int contextGroupId, Channel*, const StringView& state) = 0; |
||||
|
|
||||
|
// API methods.
|
||||
|
virtual std::unique_ptr<V8StackTrace> createStackTrace( |
||||
|
v8::Local<v8::StackTrace>) = 0; |
||||
|
virtual std::unique_ptr<V8StackTrace> captureStackTrace(bool fullStack) = 0; |
||||
|
}; |
||||
|
|
||||
|
} // namespace v8_inspector
|
||||
|
|
||||
|
#endif // V8_V8_INSPECTOR_H_
|
File diff suppressed because it is too large
@ -1 +0,0 @@ |
|||||
rmcilroy@chromium.org |
|
File diff suppressed because it is too large
@ -1 +0,0 @@ |
|||||
rmcilroy@chromium.org |
|
File diff suppressed because it is too large
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -0,0 +1,56 @@ |
|||||
|
// Copyright 2016 the V8 project authors. All rights reserved.
|
||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||
|
// found in the LICENSE file.
|
||||
|
|
||||
|
#include "src/ast/compile-time-value.h" |
||||
|
|
||||
|
#include "src/ast/ast.h" |
||||
|
#include "src/factory.h" |
||||
|
#include "src/handles-inl.h" |
||||
|
#include "src/isolate.h" |
||||
|
#include "src/objects-inl.h" |
||||
|
|
||||
|
namespace v8 { |
||||
|
namespace internal { |
||||
|
|
||||
|
bool CompileTimeValue::IsCompileTimeValue(Expression* expression) { |
||||
|
if (expression->IsLiteral()) return true; |
||||
|
MaterializedLiteral* lit = expression->AsMaterializedLiteral(); |
||||
|
return lit != NULL && lit->is_simple(); |
||||
|
} |
||||
|
|
||||
|
Handle<FixedArray> CompileTimeValue::GetValue(Isolate* isolate, |
||||
|
Expression* expression) { |
||||
|
Factory* factory = isolate->factory(); |
||||
|
DCHECK(IsCompileTimeValue(expression)); |
||||
|
Handle<FixedArray> result = factory->NewFixedArray(2, TENURED); |
||||
|
ObjectLiteral* object_literal = expression->AsObjectLiteral(); |
||||
|
if (object_literal != NULL) { |
||||
|
DCHECK(object_literal->is_simple()); |
||||
|
if (object_literal->fast_elements()) { |
||||
|
result->set(kLiteralTypeSlot, Smi::FromInt(OBJECT_LITERAL_FAST_ELEMENTS)); |
||||
|
} else { |
||||
|
result->set(kLiteralTypeSlot, Smi::FromInt(OBJECT_LITERAL_SLOW_ELEMENTS)); |
||||
|
} |
||||
|
result->set(kElementsSlot, *object_literal->constant_properties()); |
||||
|
} else { |
||||
|
ArrayLiteral* array_literal = expression->AsArrayLiteral(); |
||||
|
DCHECK(array_literal != NULL && array_literal->is_simple()); |
||||
|
result->set(kLiteralTypeSlot, Smi::FromInt(ARRAY_LITERAL)); |
||||
|
result->set(kElementsSlot, *array_literal->constant_elements()); |
||||
|
} |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
CompileTimeValue::LiteralType CompileTimeValue::GetLiteralType( |
||||
|
Handle<FixedArray> value) { |
||||
|
Smi* literal_type = Smi::cast(value->get(kLiteralTypeSlot)); |
||||
|
return static_cast<LiteralType>(literal_type->value()); |
||||
|
} |
||||
|
|
||||
|
Handle<FixedArray> CompileTimeValue::GetElements(Handle<FixedArray> value) { |
||||
|
return Handle<FixedArray>(FixedArray::cast(value->get(kElementsSlot))); |
||||
|
} |
||||
|
|
||||
|
} // namespace internal
|
||||
|
} // namespace v8
|
@ -0,0 +1,45 @@ |
|||||
|
// Copyright 2015 the V8 project authors. All rights reserved.
|
||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||
|
// found in the LICENSE file.
|
||||
|
|
||||
|
#ifndef V8_AST_COMPILE_TIME_VALUE |
||||
|
#define V8_AST_COMPILE_TIME_VALUE |
||||
|
|
||||
|
#include "src/allocation.h" |
||||
|
#include "src/globals.h" |
||||
|
|
||||
|
namespace v8 { |
||||
|
namespace internal { |
||||
|
|
||||
|
class Expression; |
||||
|
|
||||
|
// Support for handling complex values (array and object literals) that
|
||||
|
// can be fully handled at compile time.
|
||||
|
class CompileTimeValue : public AllStatic { |
||||
|
public: |
||||
|
enum LiteralType { |
||||
|
OBJECT_LITERAL_FAST_ELEMENTS, |
||||
|
OBJECT_LITERAL_SLOW_ELEMENTS, |
||||
|
ARRAY_LITERAL |
||||
|
}; |
||||
|
|
||||
|
static bool IsCompileTimeValue(Expression* expression); |
||||
|
|
||||
|
// Get the value as a compile time value.
|
||||
|
static Handle<FixedArray> GetValue(Isolate* isolate, Expression* expression); |
||||
|
|
||||
|
// Get the type of a compile time value returned by GetValue().
|
||||
|
static LiteralType GetLiteralType(Handle<FixedArray> value); |
||||
|
|
||||
|
// Get the elements array of a compile time value returned by GetValue().
|
||||
|
static Handle<FixedArray> GetElements(Handle<FixedArray> value); |
||||
|
|
||||
|
private: |
||||
|
static const int kLiteralTypeSlot = 0; |
||||
|
static const int kElementsSlot = 1; |
||||
|
}; |
||||
|
|
||||
|
} // namespace internal
|
||||
|
} // namespace v8
|
||||
|
|
||||
|
#endif // V8_AST_COMPILE_TIME_VALUE
|
@ -1,18 +0,0 @@ |
|||||
// Copyright 2011 the V8 project authors. All rights reserved.
|
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
|
||||
// found in the LICENSE file.
|
|
||||
|
|
||||
#ifndef V8_AST_SCOPEINFO_H_ |
|
||||
#define V8_AST_SCOPEINFO_H_ |
|
||||
|
|
||||
#include "src/allocation.h" |
|
||||
#include "src/ast/modules.h" |
|
||||
#include "src/ast/variables.h" |
|
||||
|
|
||||
namespace v8 { |
|
||||
namespace internal { |
|
||||
|
|
||||
} // namespace internal
|
|
||||
} // namespace v8
|
|
||||
|
|
||||
#endif // V8_AST_SCOPEINFO_H_
|
|
File diff suppressed because it is too large
@ -1,44 +0,0 @@ |
|||||
// Copyright 2016 the V8 project authors. All rights reserved.
|
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
|
||||
// found in the LICENSE file.
|
|
||||
|
|
||||
#include "src/base/accounting-allocator.h" |
|
||||
|
|
||||
#include <cstdlib> |
|
||||
|
|
||||
#if V8_LIBC_BIONIC |
|
||||
#include <malloc.h> // NOLINT |
|
||||
#endif |
|
||||
|
|
||||
namespace v8 { |
|
||||
namespace base { |
|
||||
|
|
||||
void* AccountingAllocator::Allocate(size_t bytes) { |
|
||||
void* memory = malloc(bytes); |
|
||||
if (memory) { |
|
||||
AtomicWord current = |
|
||||
NoBarrier_AtomicIncrement(¤t_memory_usage_, bytes); |
|
||||
AtomicWord max = NoBarrier_Load(&max_memory_usage_); |
|
||||
while (current > max) { |
|
||||
max = NoBarrier_CompareAndSwap(&max_memory_usage_, max, current); |
|
||||
} |
|
||||
} |
|
||||
return memory; |
|
||||
} |
|
||||
|
|
||||
void AccountingAllocator::Free(void* memory, size_t bytes) { |
|
||||
free(memory); |
|
||||
NoBarrier_AtomicIncrement(¤t_memory_usage_, |
|
||||
-static_cast<AtomicWord>(bytes)); |
|
||||
} |
|
||||
|
|
||||
size_t AccountingAllocator::GetCurrentMemoryUsage() const { |
|
||||
return NoBarrier_Load(¤t_memory_usage_); |
|
||||
} |
|
||||
|
|
||||
size_t AccountingAllocator::GetMaxMemoryUsage() const { |
|
||||
return NoBarrier_Load(&max_memory_usage_); |
|
||||
} |
|
||||
|
|
||||
} // namespace base
|
|
||||
} // namespace v8
|
|
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue