results.append(output_api.PresubmitError("C++ lint check failed"))
if not SourceProcessor().Run(input_api.PresubmitLocalPath()):
results.append(output_api.PresubmitError(
- "Copyright header and trailing whitespaces check failed"))
+ "Copyright header, trailing whitespaces and two empty lines " \
+ "between declarations check failed"))
return results
return true;
}
+
int main(int argc, char* argv[]) {
int result = RunMain(argc, argv);
v8::V8::Dispose();
args.GetReturnValue().Set(ReadLine());
}
+
v8::Handle<v8::String> ReadLine() {
const int kBufferSize = 1024 + 1;
char buffer[kBufferSize];
virtual const string& UserAgent() = 0;
};
+
/**
* The abstract superclass of http request processors.
*/
static void Log(const char* event);
};
+
/**
* An http request processor that is scriptable using JavaScript.
*/
static Persistent<ObjectTemplate> map_template_;
};
+
// -------------------------
// --- P r o c e s s o r ---
// -------------------------
return (obj == 0) ? ReportEmptyHandle(location) : false;
}
+
// --- S t a t i c s ---
return ApiCheck(InitializeHelper(isolate), location, "Error initializing V8");
}
+
// Some initializing API functions are called early and may be
// called on a thread different from static initializer thread.
// If Isolate API is used, Isolate::Enter() will initialize TLS so
kCompressedStartupDataCount
};
+
int V8::GetCompressedStartupDataCount() {
#ifdef COMPRESS_STARTUP_DATA_BZ2
return kCompressedStartupDataCount;
i::GlobalHandles::Destroy(obj);
}
+
// --- H a n d l e s ---
return str->HasOnlyOneByteChars();
}
+
// Helpers for ContainsOnlyOneByteHelper
template<size_t size> struct OneByteMask;
template<> struct OneByteMask<4> {
static inline bool Unaligned(const uint16_t* chars) {
return reinterpret_cast<const uintptr_t>(chars) & kAlignmentMask;
}
+
+
static inline const uint16_t* Align(const uint16_t* chars) {
return reinterpret_cast<uint16_t*>(
reinterpret_cast<uintptr_t>(chars) & ~kAlignmentMask);
return Utils::OpenHandle(this)->is_external();
}
+
v8::ArrayBuffer::Contents v8::ArrayBuffer::Externalize() {
i::Handle<i::JSArrayBuffer> obj = Utils::OpenHandle(this);
ApiCheck(!obj->is_external(),
disallow_heap_allocation_ = new i::DisallowHeapAllocation();
}
+
v8::AssertNoGCScope::~AssertNoGCScope() {
delete static_cast<i::DisallowHeapAllocation*>(disallow_heap_allocation_);
}
isolate->stats_table()->SetCounterFunction(callback);
}
+
void V8::SetCreateHistogramFunction(CreateHistogramCallback callback) {
i::Isolate* isolate = EnterIsolateIfNeeded();
if (IsDeadCheck(isolate, "v8::V8::SetCreateHistogramFunction()")) return;
isolate->counters()->ResetHistograms();
}
+
void V8::SetAddHistogramSampleFunction(AddHistogramSampleCallback callback) {
i::Isolate* isolate = EnterIsolateIfNeeded();
if (IsDeadCheck(isolate, "v8::V8::SetAddHistogramSampleFunction()")) return;
i::DeleteArray(str_);
}
+
Local<Value> Exception::RangeError(v8::Handle<v8::String> raw_message) {
i::Isolate* isolate = i::Isolate::Current();
LOG_API(isolate, "RangeError");
return Utils::ToLocal(result);
}
+
Local<Value> Exception::ReferenceError(v8::Handle<v8::String> raw_message) {
i::Isolate* isolate = i::Isolate::Current();
LOG_API(isolate, "ReferenceError");
return Utils::ToLocal(result);
}
+
Local<Value> Exception::SyntaxError(v8::Handle<v8::String> raw_message) {
i::Isolate* isolate = i::Isolate::Current();
LOG_API(isolate, "SyntaxError");
return Utils::ToLocal(result);
}
+
Local<Value> Exception::TypeError(v8::Handle<v8::String> raw_message) {
i::Isolate* isolate = i::Isolate::Current();
LOG_API(isolate, "TypeError");
return Utils::ToLocal(result);
}
+
Local<Value> Exception::Error(v8::Handle<v8::String> raw_message) {
i::Isolate* isolate = i::Isolate::Current();
LOG_API(isolate, "Error");
internal::Testing::set_stress_type(type);
}
+
int Testing::GetStressRuns() {
if (internal::FLAG_stress_runs != 0) return internal::FLAG_stress_runs;
#ifdef DEBUG
return ExternalReference(&CpuFeatures::supported_);
}
+
// Get the CPU features enabled by the build. For cross compilation the
// preprocessor symbols CAN_USE_ARMV7_INSTRUCTIONS and CAN_USE_VFP3_INSTRUCTIONS
// can be defined to enable ARMv7 and VFPv3 instructions when building the
am_ = am;
}
+
MemOperand::MemOperand(Register rn, Register rm, AddrMode am) {
rn_ = rn;
rm_ = rm;
return instr & kOff12Mask;
}
+
// Labels refer to positions in the (to be) generated code.
// There are bound, linked, and unused labels.
//
addrmod3(cond | B7 | B6 | B5 | B4, src1, dst);
}
+
// Load/Store multiple instructions.
void Assembler::ldm(BlockAddrMode am,
Register base,
0xA*B8 | count);
}
+
static void DoubleAsTwoUInt32(double d, uint32_t* lo, uint32_t* hi) {
uint64_t i;
OS::MemCopy(&i, &d, 8);
*hi = i >> 32;
}
+
// Only works for little endian floating point formats.
// We don't support VFP on the mixed endian floating point platform.
static bool FitsVMOVDoubleImmediate(double d, uint32_t *encoding) {
#endif
}
+
void Assembler::GrowBuffer() {
if (!own_buffer_) FATAL("external code buffer is too small");
}
}
+
void Assembler::RecordRelocInfo(double data) {
// We do not try to reuse pool constants.
RelocInfo rinfo(pc_, data);
RememberedSetAction action;
};
+
#define REG(Name) { kRegister_ ## Name ## _Code }
static const AheadOfTimeWriteBarrierStubList kAheadOfTime[] = {
return &sqrt;
}
+
// -------------------------------------------------------------------------
// Platform-specific RuntimeCallHelper functions.
Print(converter_.NameOfCPURegister(reg));
}
+
// Print the VFP S register name according to the active name converter.
void Decoder::PrintSRegister(int reg) {
Print(VFPRegisters::Name(reg, false));
}
+
// Print the VFP D register name according to the active name converter.
void Decoder::PrintDRegister(int reg) {
Print(VFPRegisters::Name(reg, true));
}
}
+
void MacroAssembler::GetCFunctionDoubleResult(const DwVfpRegister dst) {
if (use_eabi_hardfloat()) {
Move(dst, d0);
registers_[12] = 0x50Bad4U;
}
+
// Some Operating Systems allow unaligned access on ARMv7 targets. We
// assume that unaligned accesses are not allowed unless the v8 build system
// defines the CAN_USE_UNALIGNED_ACCESSES macro to be non-zero.
}
}
+
// Addressing Mode 4 - Load and Store Multiple
void Simulator::HandleRList(Instruction* instr, bool load) {
int rlist = instr->RlistValue();
FixedDoubleArray::canonical_not_the_hole_nan_as_double() : value;
}
+
// Stop helper functions.
bool Simulator::isStopInstruction(Instruction* instr) {
return (instr->Bits(27, 24) == 0xF) && (instr->SvcValue() >= kStopCode);
}
}
+
void RelocInfoWriter::WriteExtraTaggedConstPoolData(int data) {
WriteExtraTag(kConstPoolExtraTag, kConstPoolTag);
for (int i = 0; i < kIntSize; i++) {
}
}
+
void RelocInfoWriter::WriteExtraTaggedData(intptr_t data_delta, int top_tag) {
WriteExtraTag(kDataJumpExtraTag, top_tag);
for (int i = 0; i < kIntptrSize; i++) {
return ExternalReference(Redirect(isolate, function));
}
+
ExternalReference ExternalReference::re_grow_stack(Isolate* isolate) {
return ExternalReference(
Redirect(isolate, FUNCTION_ADDR(NativeRegExpMacroAssembler::GrowStack)));
FUNCTION_ADDR(NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16)));
}
+
ExternalReference ExternalReference::re_word_character_map() {
return ExternalReference(
NativeRegExpMacroAssembler::word_character_map_address());
}
};
+
// A global to get use initialized on startup via static initialization :/
AtomicOpsx86Initializer g_initer;
return 8 * sizeof(value);
}
+
// Guaranteed to lie in one Bigit.
void Bignum::AssignUInt16(uint16_t value) {
ASSERT(kBigitSize >= BitSize(value));
to_complete_property_descriptor);
}
+
void Genesis::InstallExperimentalNativeFunctions() {
if (FLAG_harmony_proxies) {
INSTALL_NATIVE(JSFunction, "DerivedHasTrap", derived_has_trap);
#endif
}
+
static uint32_t Hash(RegisteredExtension* extension) {
return v8::internal::ComputePointerHash(extension);
}
+
static bool MatchRegisteredExtensions(void* key1, void* key2) {
return key1 == key2;
}
return result;
}
+
// ----------------------------------------------------------------------------
BUILTIN(Illegal) {
"strict_poison_pill", HandleVector<Object>(NULL, 0)));
}
+
// -----------------------------------------------------------------------------
//
KeyedLoadIC::GeneratePreMonomorphic(masm);
}
+
static void Generate_KeyedLoadIC_IndexedInterceptor(MacroAssembler* masm) {
KeyedLoadIC::GenerateIndexedInterceptor(masm);
}
+
static void Generate_KeyedLoadIC_NonStrictArguments(MacroAssembler* masm) {
KeyedLoadIC::GenerateNonStrictArguments(masm);
}
+
static void Generate_StoreIC_Slow(MacroAssembler* masm) {
StoreIC::GenerateSlow(masm);
}
KeyedStoreIC::GenerateInitialize(masm);
}
+
static void Generate_KeyedStoreIC_NonStrictArguments(MacroAssembler* masm) {
KeyedStoreIC::GenerateNonStrictArguments(masm);
}
+
static void Generate_TransitionElementsSmiToDouble(MacroAssembler* masm) {
KeyedStoreIC::GenerateTransitionElementsSmiToDouble(masm);
}
+
static void Generate_TransitionElementsDoubleToObject(MacroAssembler* masm) {
KeyedStoreIC::GenerateTransitionElementsDoubleToObject(masm);
}
#undef DEF_FUNCTION_PTR_A
}
+
void Builtins::SetUp(bool create_heap_objects) {
ASSERT(!initialized_);
Isolate* isolate = Isolate::Current();
}
}
+
void CodeStub::PrintBaseName(StringStream* stream) {
stream->Add("%s", MajorName(MajorKey(), false));
}
#endif
}
+
void CompareNilICStub::PrintBaseName(StringStream* stream) {
CodeStub::PrintBaseName(stream);
stream->Add((nil_value_ == kNullValue) ? "(NullValue)":
"(UndefinedValue)");
}
+
void CompareNilICStub::PrintState(StringStream* stream) {
state_.Print(stream);
}
return result;
}
+
void CompilationSubCache::Age() {
// Age the generations implicitly killing off the oldest.
for (int i = generations_ - 1; i > 0; i--) {
return SetLastStatus(SUCCEEDED);
}
+
OptimizingCompiler::Status OptimizingCompiler::OptimizeGraph() {
DisallowHeapAllocation no_allocation;
DisallowHandleAllocation no_handles;
return native_context()->global_proxy_object();
}
+
void Context::set_global_proxy(JSObject* object) {
native_context()->set_global_proxy_object(object);
}
CreateHistogram(name_, min_, max_, num_buckets_);
}
+
// Start the timer.
void HistogramTimer::Start() {
if (Enabled()) {
}
}
+
// Stop the timer and record the results.
void HistogramTimer::Stop() {
if (Enabled()) {
profiles_ = new CpuProfilesCollection();
}
+
void CpuProfiler::StartProfiling(const char* title, bool record_samples) {
if (profiles_->StartProfiling(title, next_profile_uid_++, record_samples)) {
StartProcessorIfNotStarted();
array_buffer->Dispose();
}
+
void Shell::ReadBuffer(const v8::FunctionCallbackInfo<v8::Value>& args) {
ASSERT(sizeof(char) == sizeof(uint8_t)); // NOLINT
String::Utf8Value filename(args[0]);
return true;
}
+
bool DateParser::TimeZoneComposer::Write(FixedArray* output) {
if (sign_ != kNone) {
if (hour_ == kNone) hour_ = 0;
thread_local_.step_count_ = 0;
}
+
// Clears all the one-shot break points that are currently set. Normally this
// function is called each time a break point is hit as one shot break points
// are used to support stepping.
int Disassembler::Decode(Isolate* isolate, FILE* f, byte* begin, byte* end) {
return 0;
}
+
+
void Disassembler::Decode(FILE* f, Code* code) {}
#endif // ENABLE_DISASSEMBLER
return fast_elements_kind_sequence.Get()[sequence_number];
}
+
int GetSequenceIndexFromFastElementsKind(ElementsKind elements_kind) {
for (int i = 0; i < kFastElementsKindCount; ++i) {
if (fast_elements_kind_sequence.Get()[i] == elements_kind) {
return isolate->heap()->undefined_value();
}
+
void Execution::ProcessDebugMessages(bool debug_command_only) {
Isolate* isolate = Isolate::Current();
// Clear the debug command request flag.
object->Dispose(isolate);
}
+
// Throws a JavaScript exception.
static v8::Handle<v8::Value> ThrowUnexpectedObjectError() {
// Returns undefined, and schedules an exception to be thrown.
"that is not a BreakIterator.")));
}
+
// Deletes the old value and sets the adopted text in corresponding
// JavaScript object.
icu::UnicodeString* ResetAdoptedText(
object->Dispose(isolate);
}
+
// Throws a JavaScript exception.
static v8::Handle<v8::Value> ThrowUnexpectedObjectError() {
// Returns undefined, and schedules an exception to be thrown.
"that is not a Collator.")));
}
+
// When there's an ICU error, throw a JavaScript error with |message|.
static v8::Handle<v8::Value> ThrowExceptionForICUError(const char* message) {
return v8::ThrowException(v8::Exception::Error(v8::String::New(message)));
}
+
// static
void Collator::JSInternalCompare(
const v8::FunctionCallbackInfo<v8::Value>& args) {
return v8::Handle<v8::FunctionTemplate>();
}
+
void Extension::Register() {
static Extension i18n_extension;
static v8::DeclareExtension extension_declaration(&i18n_extension);
dest[length - 1] = '\0';
}
+
// static
bool Utils::V8StringToUnicodeString(const v8::Handle<v8::Value>& input,
icu::UnicodeString* output) {
return true;
}
+
// static
bool Utils::ExtractStringSetting(const v8::Handle<v8::Object>& settings,
const char* setting,
return false;
}
+
// static
bool Utils::ExtractIntegerSetting(const v8::Handle<v8::Object>& settings,
const char* setting,
return false;
}
+
// static
bool Utils::ExtractBooleanSetting(const v8::Handle<v8::Object>& settings,
const char* setting,
return false;
}
+
// static
void Utils::AsciiToUChar(const char* source,
int32_t source_length,
target[length - 1] = 0x0u;
}
+
// static
// Chrome Linux doesn't like static initializers in class, so we create
// template on demand.
return v8::Local<v8::ObjectTemplate>::New(isolate, icu_template);
}
+
// static
// Chrome Linux doesn't like static initializers in class, so we create
// template on demand. This one has 2 internal fields.
args.GetReturnValue().Set(v8::String::New(result));
}
+
void JSAvailableLocalesOf(const v8::FunctionCallbackInfo<v8::Value>& args) {
// Expect service name which is a string.
if (args.Length() != 1 || !args[0]->IsString()) {
args.GetReturnValue().Set(locales);
}
+
void JSGetDefaultICULocale(const v8::FunctionCallbackInfo<v8::Value>& args) {
icu::Locale default_locale;
args.GetReturnValue().Set(v8::String::New("und"));
}
+
void JSGetLanguageTagVariants(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::TryCatch try_catch;
String);
}
+
// Internalized strings are created in the old generation (data space).
Handle<String> Factory::InternalizeString(Handle<String> string) {
CALL_HEAP_FUNCTION(isolate(),
String);
}
+
Handle<String> Factory::InternalizeOneByteString(Vector<const uint8_t> string) {
CALL_HEAP_FUNCTION(isolate(),
isolate()->heap()->InternalizeOneByteString(string),
JSMessageObject);
}
+
Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo(Handle<String> name) {
CALL_HEAP_FUNCTION(isolate(),
isolate()->heap()->AllocateSharedFunctionInfo(*name),
}
}
+
bool StackTraceFrameIterator::IsValidFrame() {
if (!frame()->function()->IsJSFunction()) return false;
Object* script = JSFunction::cast(frame()->function())->shared()->script();
ASSERT(i == kNumJSCallerSaved);
}
+
int JSCallerSavedCode(int n) {
ASSERT(0 <= n && n < kNumJSCallerSaved);
return caller_saved_code_data.reg_code[n];
return NULL;
}
+
Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone) {
ZoneList<StackFrame*> list(10, zone);
for (StackFrameIterator it(isolate); !it.done(); it.Advance()) {
void BreakableStatementChecker::VisitModuleLiteral(ModuleLiteral* module) {
}
+
void BreakableStatementChecker::VisitModuleVariable(ModuleVariable* module) {
}
+
void BreakableStatementChecker::VisitModulePath(ModulePath* module) {
}
+
void BreakableStatementChecker::VisitModuleUrl(ModuleUrl* module) {
}
}
}
+
static void AddUnwindInfo(CodeDescription* desc) {
#if V8_TARGET_ARCH_X64
if (desc->tag() == GDBJITInterface::FUNCTION) {
PrintF(" # total = %d\n", total);
}
+
void GlobalHandles::Print() {
PrintF("Global handles:\n");
for (NodeIterator it(this); !it.done(); it.Advance()) {
return right + script->line_offset()->value();
}
+
// Convert code position into column number.
int GetScriptColumnNumber(Handle<Script> script, int code_pos) {
int line_number = GetScriptLineNumber(script, code_pos);
return code_pos - (prev_line_end_pos + 1);
}
+
int GetScriptLineNumberSafe(Handle<Script> script, int code_pos) {
DisallowHeapAllocation no_allocation;
if (!script->line_ends()->IsUndefined()) {
return TakeSnapshot(snapshots_->names()->GetName(name), control, resolver);
}
+
void HeapProfiler::StartHeapObjectsTracking() {
snapshots_->StartHeapObjectsTracking();
}
time_intervals_.Clear();
}
+
void HeapObjectsMap::UpdateHeapObjectsMap() {
HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask,
"HeapSnapshotsCollection::UpdateHeapObjectsMap");
embedder_queried_ = true;
}
+
void NativeObjectsExplorer::FillImplicitReferences() {
Isolate* isolate = Isolate::Current();
List<ImplicitRefGroup*>* groups =
w->AddCharacter(hex_chars[u & 0xf]);
}
+
void HeapSnapshotJSONSerializer::SerializeString(const unsigned char* s) {
writer_->AddCharacter('\n');
writer_->AddCharacter('\"');
}
}
+
ExternalArray* Heap::EmptyExternalArrayForMap(Map* map) {
return ExternalArray::cast(
roots_[RootIndexForEmptyExternalArray(map->elements_kind())]);
String::WriteToFlat(s, chars, 0, len);
}
+
static inline void WriteTwoByteData(String* s, uint16_t* chars, int len) {
ASSERT(s->length() == len);
String::WriteToFlat(s, chars, 0, len);
return result;
}
+
MaybeObject* Heap::AllocateEmptyExternalArray(ExternalArrayType array_type) {
return AllocateExternalArray(0, array_type, NULL, TENURED);
}
MarkCompactCollector::Initialize();
}
+
bool Heap::SetUp() {
#ifdef DEBUG
allocation_timeout_ = FLAG_gc_interval;
return true;
}
+
bool Heap::CreateHeapObjects() {
// Create initial maps.
if (!CreateInitialMaps()) return false;
}
};
+
void Heap::PrintHandles() {
PrintF("Handles:\n");
PrintHandleVisitor v;
va_end(arguments);
}
+
// Wrap TraceGVN in macros to avoid the expense of evaluating its arguments when
// --trace-gvn is off.
#define TRACE_GVN_1(msg, a1) \
return *this;
}
+
void HSideEffectMap::Kill(GVNFlagSet flags) {
for (int i = 0; i < kNumberOfTrackedSideEffects; i++) {
GVNFlag changes_flag = HValue::ChangesFlagFromInt(i);
int length_;
};
+
// This is a recursive traversal of the dominator tree but it has been turned
// into a loop to avoid stack overflows.
// The logical "stack frames" of the recursion are kept in a list of
return "";
}
+
void HCheckInstanceType::PrintDataTo(StringStream* stream) {
stream->Add("%s ", GetCheckName());
HUnaryOperation::PrintDataTo(stream);
}
}
+
// Block ordering was implemented with two mutually recursive methods,
// HGraph::Postorder and HGraph::PostorderLoopBlocks.
// The recursion could lead to stack overflow so the algorithm has been
return new(zone()) HStringCharCodeAt(context, string, checked_index);
}
+
// Checks if the given shift amounts have form: (sa) and (32 - sa).
static bool ShiftAmountsAllowReplaceByRotate(HValue* sa,
HValue* const32_minus_sa) {
}
}
+
void HOptimizedGraphBuilder::VisitThisFunction(ThisFunction* expr) {
ASSERT(!HasStackOverflow());
ASSERT(current_block() != NULL);
}
}
+
void Assembler::ror(Register dst, uint8_t imm8) {
EnsureSpace ensure_space(this);
ASSERT(is_uint5(imm8)); // illegal shift count
}
}
+
void Assembler::ror_cl(Register dst) {
EnsureSpace ensure_space(this);
EMIT(0xD3);
EMIT(static_cast<byte>(mode) | 0x8);
}
+
void Assembler::movmskpd(Register dst, XMMRegister src) {
ASSERT(IsEnabled(SSE2));
EnsureSpace ensure_space(this);
rinfo()->PatchCode(original_rinfo()->pc(), Assembler::kDebugBreakSlotLength);
}
+
// All debug break stubs support padding for LiveEdit.
const bool Debug::FramePaddingLayout::kIsSupported = true;
}
}
+
int DisassemblerIA32::D1D3C1Instruction(byte* data) {
byte op = *data;
ASSERT(op == 0xD1 || op == 0xD3 || op == 0xC1);
}
}
+
void LCodeGen::DoMathRound(LMathRound* instr) {
CpuFeatureScope scope(masm(), SSE2);
Register output_reg = ToRegister(instr->result());
LeaveExitFrameEpilogue();
}
+
void MacroAssembler::LeaveExitFrameEpilogue() {
// Restore current context from top and clear it in debug mode.
ExternalReference context_address(Isolate::kContextAddress, isolate());
__ bind(&after_position);
}
+
void RegExpMacroAssemblerIA32::SetRegister(int register_index, int to) {
ASSERT(register_index >= num_saved_registers_); // Reserved for positions!
__ mov(register_location(register_index), Immediate(to));
}
}
+
void IncrementalMarking::UncommitMarkingDeque() {
if (state_ == STOPPED && marking_deque_memory_committed_) {
bool success = marking_deque_memory_->Uncommit(
Iterate(v, current_t);
}
+
void Isolate::IterateDeferredHandles(ObjectVisitor* visitor) {
for (DeferredHandles* deferred = deferred_handles_head_;
deferred != NULL;
return label->label();
}
+
void LChunk::MarkEmptyBlocks() {
LPhase phase("L_Mark empty blocks", this);
for (int i = 0; i < graph()->blocks()->length(); ++i) {
USE(no_failure);
}
+
// A simple implementation of dynamic programming algorithm. It solves
// the problem of finding the difference of 2 arrays. It uses a table of results
// of subproblems. Each cell contains a number together with 2-bit flag
static const int kMaximalBufferSize = 512*MB;
};
+
// Patch positions in code (changes relocation info section) and possibly
// returns new instance of code.
static Handle<Code> PatchPositionsInCode(
Handle<JSArray> m_result;
};
+
// Drops all call frame matched by target and all frames above them.
template<typename TARGET>
static const char* DropActivationsInActiveThreadImpl(
return NULL;
}
+
// Fills result array with statuses of functions. Modifies the stack
// removing all listed function if possible and if do_drop is true.
static const char* DropActivationsInActiveThread(
code_event_handler_(&event);
}
+
void* Logger::IssueStartCodePosInfoEvent() {
JitCodeEvent event;
memset(&event, 0, sizeof(event));
return event.user_data;
}
+
void Logger::IssueEndCodePosInfoEvent(Code* code, void* jit_handler_data) {
JitCodeEvent event;
memset(&event, 0, sizeof(event));
ApiEvent("api,%s,\"%s\",%u\n", tag, *class_name, index);
}
+
void Logger::ApiObjectAccess(const char* tag, JSObject* object) {
if (!log_->IsEnabled() || !FLAG_log_api) return;
String* class_name_obj = object->class_name();
}
}
+
void Logger::CodeStartLinePosInfoRecordEvent(PositionsRecorder* pos_recorder) {
if (code_event_handler_ != NULL) {
pos_recorder->AttachJITHandlerData(IssueStartCodePosInfoEvent());
}
}
+
void Logger::SnapshotPositionEvent(Address addr, int pos) {
if (!log_->IsEnabled()) return;
if (FLAG_ll_prof) LowLevelSnapshotPositionEvent(addr, pos);
(opcode == COP1 && rs_field == BC1); // Coprocessor branch.
}
+
bool Assembler::IsEmittedConstant(Instr instr) {
uint32_t label_constant = GetLabelConst(instr);
return label_constant == 0; // Emitted label const in reg-exp engine.
}
+
bool Assembler::IsBeq(Instr instr) {
return GetOpcodeField(instr) == BEQ;
}
return GetOpcodeField(instr) == JAL;
}
+
bool Assembler::IsJr(Instr instr) {
return GetOpcodeField(instr) == SPECIAL && GetFunctionField(instr) == JR;
}
+
bool Assembler::IsJalr(Instr instr) {
return GetOpcodeField(instr) == SPECIAL && GetFunctionField(instr) == JALR;
}
}
}
+
bool Assembler::is_near(Label* L) {
if (L->is_bound()) {
return ((pc_offset() - L->pos()) < kMaxBranchOffset - 4 * kInstrSize);
return false;
}
+
// We have to use a temporary register for things that can be relocated even
// if they can be encoded in the MIPS's 16 bits of immediate-offset instruction
// space. There is no guarantee that the relocated location can be similarly
GenInstrRegister(COP1, CFC1, rt, fs);
}
+
void Assembler::DoubleAsTwoUInt32(double d, uint32_t* lo, uint32_t* hi) {
uint64_t i;
OS::MemCopy(&i, &d, 8);
*hi = i >> 32;
}
+
// Arithmetic.
void Assembler::add_d(FPURegister fd, FPURegister fs, FPURegister ft) {
CPU::FlushICache(pc, (patched_jump ? 3 : 2) * sizeof(int32_t));
}
+
void Assembler::JumpLabelToJumpRegister(Address pc) {
// Address pc points to lui/ori instructions.
// Jump to label may follow at pc + 2 * kInstrSize.
GenerateMiss(masm);
}
+
void ICCompareStub::GenerateMiss(MacroAssembler* masm) {
{
// Call the runtime system in a fresh internal frame.
RememberedSetAction action;
};
+
#define REG(Name) { kRegister_ ## Name ## _Code }
static const AheadOfTimeWriteBarrierStubList kAheadOfTime[] = {
return &sqrt;
}
+
// -------------------------------------------------------------------------
// Platform-specific RuntimeCallHelper functions.
masm->set_has_frame(false);
}
+
// -------------------------------------------------------------------------
// Code generators
"pc"
};
+
// List of alias names which can be used when referring to MIPS registers.
const Registers::RegisterAlias Registers::aliases_[] = {
{0, "zero"},
{kInvalidRegister, NULL}
};
+
const char* Registers::Name(int reg) {
const char* result;
if ((0 <= reg) && (reg < kNumSimuRegisters)) {
"f22", "f23", "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31"
};
+
// List of alias names which can be used when referring to MIPS registers.
const FPURegisters::RegisterAlias FPURegisters::aliases_[] = {
{kInvalidRegister, NULL}
};
+
const char* FPURegisters::Name(int creg) {
const char* result;
if ((0 <= creg) && (creg < kNumFPURegisters)) {
__ bind(&receiver_ok);
}
+
void LCodeGen::DoApplyArguments(LApplyArguments* instr) {
Register receiver = ToRegister(instr->receiver());
Register function = ToRegister(instr->function());
__ sub_d(f0, f12, f14);
}
+
void LCodeGen::DoDeferredRandom(LRandom* instr) {
__ PrepareCallCFunction(1, scratch0());
__ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1);
return new(zone()) LDebugBreak();
}
+
void LCmpIDAndBranch::PrintDataTo(StringStream* stream) {
stream->Add("if ");
left()->PrintTo(stream);
}
}
+
//------------Pseudo-instructions-------------
void MacroAssembler::li(Register rd, Operand j, LiFlags mode) {
mtc1(t8, fd);
}
+
void MacroAssembler::Trunc_w_d(FPURegister fd, FPURegister fs) {
if (kArchVariant == kLoongson && fd.is(fs)) {
mfc1(t8, FPURegister::from_code(fs.code() + 1));
}
}
+
void MacroAssembler::Round_w_d(FPURegister fd, FPURegister fs) {
if (kArchVariant == kLoongson && fd.is(fs)) {
mfc1(t8, FPURegister::from_code(fs.code() + 1));
nop();
}
+
void MacroAssembler::DropAndRet(int drop) {
Ret(USE_DELAY_SLOT);
addiu(sp, sp, drop * kPointerSize);
VerifyPointer(construct_trap());
}
+
void JSArrayBuffer::JSArrayBufferVerify() {
CHECK(IsJSArrayBuffer());
JSObjectVerify();
VerifyPointer(property_list());
}
+
void FunctionTemplateInfo::FunctionTemplateInfoVerify() {
CHECK(IsFunctionTemplateInfo());
TemplateInfoVerify();
number_of_slow_unused_elements_ = 0;
}
+
void JSObject::SpillInformation::Print() {
PrintF("\n JSObject Spill Statistics (#%d):\n", number_of_objects_);
"???", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
};
+
void JSDate::JSDatePrint(FILE* out) {
HeapObject::PrintHeader(out, "JSDate");
PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map()));
CHECK_EQ(target, old_target); // VisitPointer doesn't change Code* *target.
}
+
void ObjectVisitor::VisitEmbeddedPointer(RelocInfo* rinfo) {
ASSERT(rinfo->rmode() == RelocInfo::EMBEDDED_OBJECT);
VisitPointer(rinfo->target_object_address());
}
+
void ObjectVisitor::VisitExternalReference(RelocInfo* rinfo) {
Address* p = rinfo->target_reference_address();
VisitExternalReferences(p, p + 1);
}
+
byte Code::compare_nil_state() {
ASSERT(is_compare_nil_ic_stub());
return CompareNilICStub::ExtractTypesFromExtraICState(
extended_extra_ic_state());
}
+
byte Code::compare_nil_value() {
ASSERT(is_compare_nil_ic_stub());
return CompareNilICStub::ExtractNilValueFromExtraICState(
Smi* flags_;
};
+
// Utf8StringKey carries a vector of chars as key.
class Utf8StringKey : public HashTableKey {
public:
return entry;
}
+
// Force instantiation of template instances class.
// Please note this list is compiler dependent.
return result_double;
}
+
ExternalArrayType JSTypedArray::type() {
switch (elements()->map()->instance_type()) {
case EXTERNAL_BYTE_ARRAY_TYPE:
return LookupKey(&key, s);
}
+
MaybeObject* StringTable::LookupKey(HashTableKey* key, Object** s) {
int entry = FindEntry(key);
return result;
}
+
Scanner::Location ScriptDataImpl::MessageLocation() {
int beg_pos = Read(PreparseDataConstants::kMessageStartPos);
int end_pos = Read(PreparseDataConstants::kMessageEndPos);
return isolate()->factory()->uninitialized_value();
}
+
// Validation per 11.1.5 Object Initialiser
class ObjectLiteralPropertyChecker {
public:
return factory()->NewThrow(call_constructor, scanner().location().beg_pos);
}
+
// ----------------------------------------------------------------------------
// Regular expressions
return simple_;
}
+
RegExpTree* RegExpParser::ReportError(Vector<const char> message) {
failed_ = true;
*error_ = isolate()->factory()->NewStringFromAscii(message, NOT_TENURED);
POSIXPostSetUp();
}
+
uint64_t OS::CpuFeaturesImpliedByPlatform() {
return 0; // Nothing special about Cygwin.
}
Release_Store(&tls_base_offset_initialized, 1);
}
+
static void CheckFastTls(Thread::LocalStorageKey key) {
void* expected = reinterpret_cast<void*>(0x1234CAFE);
Thread::SetThreadLocal(key, expected);
}
}
+
Semaphore* OS::CreateSemaphore(int count) {
return new OpenBSDSemaphore(count);
}
memmove(dest, src, size);
}
+
// Initialize to library version so we can call this at any time during startup.
static OS::MemMoveFunction memmove_function = &MemMoveWrapper;
init_fast_sqrt_function();
}
+
// ----------------------------------------------------------------------------
// POSIX string support.
//
memmove(dest, src, size);
}
+
// Initialize to library version so we can call this at any time during startup.
static OS::MemMoveFunction memmove_function = &MemMoveWrapper;
modulo_function = CreateModuloFunction();
}
+
double modulo(double x, double y) {
// Note: here we rely on dependent reads being ordered. This is true
// on all architectures we currently support.
TimeStamp time_;
};
+
// Static variables.
bool Time::tz_initialized_ = false;
TIME_ZONE_INFORMATION Time::tzinfo_;
return t.ToJSTime();
}
+
// Returns the tickcounter based on timeGetTime.
int64_t OS::Ticks() {
return timeGetTime() * 1000; // Convert to microseconds.
return frames_count;
}
+
// Restore warnings to previous settings.
#pragma warning(pop)
}
}
+
// ----------------------------------------------------------------------------
// PartialParserRecorder - Record both function entries and symbols.
return result;
}
+
bool PreParser::peek_any_identifier() {
i::Token::Value next = peek();
return next == i::Token::IDENTIFIER ||
return AddSymbol(i::Vector<const byte>::cast(key), true, value);
}
+
int DuplicateFinder::AddUtf16Symbol(i::Vector<const uint16_t> key, int value) {
return AddSymbol(i::Vector<const byte>::cast(key), false, value);
}
int security_token_id_;
};
+
void ProfileTree::FilteredClone(ProfileTree* src, int security_token_id) {
ms_to_ticks_scale_ = src->ms_to_ticks_scale_;
FilteredCloneCallback cb(root_, security_token_id);
delete *entry_ptr;
}
+
static void DeleteCpuProfile(CpuProfile** profile_ptr) {
delete *profile_ptr;
}
+
static void DeleteProfilesList(List<CpuProfile*>** list_ptr) {
if (*list_ptr != NULL) {
(*list_ptr)->Iterate(DeleteCpuProfile);
}
}
+
CpuProfilesCollection::~CpuProfilesCollection() {
delete current_profiles_semaphore_;
current_profiles_.Iterate(DeleteCpuProfile);
return -1;
}
+
RUNTIME_FUNCTION(MaybeObject*, Runtime_StringLastIndexOf) {
HandleScope scope(isolate);
ASSERT(args.length() == 3);
return isolate->heap()->undefined_value();
}
+
// Implements part of 8.12.9 DefineOwnProperty.
// There are 3 cases that lead here:
// Step 4a - define a new data property.
return isolate->transcendental_cache()->Get(TranscendentalCache::LOG, x);
}
+
// Slow version of Math.pow. We check for fast paths for special cases.
// Used if SSE2/VFP3 is not available.
RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_pow) {
return isolate->heap()->AllocateHeapNumber(result);
}
+
// Fast version of Math.pow if we know that y is not an integer and y is not
// -0.5 or 0.5. Used as slow case from full codegen.
RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_pow_cfunction) {
MaybeObject* y;
};
+
static inline ObjectPair MakePair(MaybeObject* x, MaybeObject* y) {
ObjectPair result = {x, y};
// Pointers x and y returned in rax and rdx, in AMD-x64-abi.
return string;
}
+
// Moves all own elements of an object, that are below a limit, to positions
// starting at zero. All undefined values are placed after non-undefined values,
// and are followed by non-existing element. Does not change the length
return *isolate->factory()->NewJSArrayWithElements(details);
}
+
// Return an array with scope details
// args[0]: number: break id
// args[1]: number: frame index
return counter;
}
+
// For a script finds all SharedFunctionInfo's in the heap that points
// to this script. Returns JSArray of SharedFunctionInfo wrapped
// in OpaqueReferences.
return *result;
}
+
// For a script calculates compilation information about all its functions.
// The script source is explicitly specified by the second argument.
// The source of the actual script is not used, however it is important that
return result;
}
+
// Changes the source of the script to a new_source.
// If old_script_name is provided (i.e. is a String), also creates a copy of
// the script with its original source and sends notification to debugger.
return LiveEdit::ReplaceFunctionCode(new_compile_info, shared_info);
}
+
// Connects SharedFunctionInfo to another script.
RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditFunctionSetScript) {
HandleScope scope(isolate);
return *LiveEdit::CheckAndDropActivations(shared_array, do_drop);
}
+
// Compares 2 strings line-by-line, then token-wise and returns diff in form
// of JSArray of triplets (pos1, pos1_end, pos2_end) describing list
// of diff chunks.
delete data_;
}
+
void Sampler::Start() {
ASSERT(!IsActive());
SetActive(true);
SetActive(false);
}
+
void Sampler::SampleStack(const RegisterState& state) {
TickSample* sample = isolate_->cpu_profiler()->TickSampleEvent();
TickSample sample_obj;
buffer_end_ = buffer_;
}
+
BufferedUtf16CharacterStream::~BufferedUtf16CharacterStream() { }
void BufferedUtf16CharacterStream::PushBack(uc32 character) {
return BufferSeekForward(delta);
}
+
// ----------------------------------------------------------------------------
// GenericStringUtf16CharacterStream
chunk->IncrementLiveBytes(by);
}
+
// -----------------------------------------------------------------------------
// PagedSpace implementation
return Failure::Exception();
}
+
bool PagedSpace::CanExpand() {
ASSERT(max_capacity_ % AreaSize() == 0);
}
}
+
// Because the copying collector does not touch garbage objects, we iterate
// the new space before a collection to get a histogram of allocated objects.
// This only happens when --log-gc flag is set.
return size;
}
+
// -----------------------------------------------------------------------------
// Free lists for old object spaces implementation
exponent + (buffer.length() - kMaxSignificantDecimalDigits);
}
+
// Reads digits from the buffer and converts them to a uint64.
// Reads in as many digits as fit into a uint64.
// When the string starts with "1844674407370955161" no further digit is read.
}
}
+
CallOptimization::CallOptimization(Handle<JSFunction> function) {
Initialize(function);
}
return false;
}
+
// Get non-bitsets from this which are not subsumed by union, store at unioned,
// starting at index. Returns updated index.
int Type::ExtendUnion(Handle<Unioned> result, int current_size) {
return table[D * index];
}
+
static inline uchar GetEntry(int32_t entry) {
return entry & (kStartBit - 1);
}
+
static inline bool IsStart(int32_t entry) {
return (entry & kStartBit) != 0;
}
+
/**
* Look up a character in the unicode table using a mix of binary and
* interpolation search. For a uniformly distributed array
uchar chars[kW];
};
+
// Look up the mapping for the given character in the specified table,
// which is of the specified length and uses the specified special case
// mapping for multi-char mappings. The next parameter is the character
}
}
+
// Lowercase: point.category == 'Ll'
static const uint16_t kLowercaseTable0Size = 463;
}
}
+
// Letter: point.category in ['Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl' ]
static const uint16_t kLetterTable0Size = 435;
}
}
+
// Space: point.category == 'Zs'
static const uint16_t kSpaceTable0Size = 4;
}
}
+
// Number: point.category == 'Nd'
static const uint16_t kNumberTable0Size = 56;
}
}
+
// WhiteSpace: 'Ws' in point.properties
static const uint16_t kWhiteSpaceTable0Size = 7;
}
}
+
// LineTerminator: 'Lt' in point.properties
static const uint16_t kLineTerminatorTable0Size = 2;
}
}
+
// CombiningMark: point.category in ['Mn', 'Mc']
static const uint16_t kCombiningMarkTable0Size = 258;
}
}
+
// ConnectorPunctuation: point.category == 'Pc'
static const uint16_t kConnectorPunctuationTable0Size = 1;
#undef SC
}
+
void Counters::ResetHistograms() {
#define HT(name, caption) name##_.Reset();
HISTOGRAM_TIMER_LIST(HT)
return heap_number;
}
+
void V8::InitializeOncePerProcessImpl() {
FlagList::EnforceFlagImplications();
if (FLAG_stress_compaction) {
Bootstrapper::InitializeOncePerProcess();
}
+
void V8::InitializeOncePerProcess() {
CallOnce(&init_once, &InitializeOncePerProcessImpl);
}
return data != NULL && data->thread_state() != NULL;
}
+
void ThreadManager::Iterate(ObjectVisitor* v) {
// Expecting no threads during serialization/deserialization
for (ThreadState* state = FirstThreadStateInUse();
emit(0xF8);
}
+
void Assembler::cld() {
EnsureSpace ensure_space(this);
emit(0xFC);
}
+
void Assembler::cdq() {
EnsureSpace ensure_space(this);
emit(0x99);
emit(b2 + i);
}
+
// SSE 2 operations.
void Assembler::movd(XMMRegister dst, Register src) {
}
}
+
void Assembler::movdqa(const Operand& dst, XMMRegister src) {
EnsureSpace ensure_space(this);
emit(0x66);
emit(0xC0 | (dst.low_bits() << 3) | src.low_bits());
}
+
void Assembler::emit_sse_operand(XMMRegister dst, Register src) {
emit(0xC0 | (dst.low_bits() << 3) | src.low_bits());
}
+
void Assembler::emit_sse_operand(Register dst, XMMRegister src) {
emit(0xC0 | (dst.low_bits() << 3) | src.low_bits());
}
reloc_info_writer.Write(&rinfo);
}
+
void Assembler::RecordJSReturn() {
positions_recorder()->WriteRecordedPositions();
EnsureSpace ensure_space(this);
__ Abort("no cases left");
}
+
void Builtins::Generate_NotifyDeoptimized(MacroAssembler* masm) {
Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::EAGER);
}
__ bind(&hash_not_zero);
}
+
void SubStringStub::Generate(MacroAssembler* masm) {
Label runtime;
BYTE_OPER_REG_OP_ORDER = OPER_REG_OP_ORDER | BYTE_SIZE_OPERAND_FLAG
};
+
//------------------------------------------------------------------
// Tables
//------------------------------------------------------------------
{"cmovg", TWO_OPERANDS_INSTR, REG_OPER_OP_ORDER, false}
};
+
//------------------------------------------------------------------------------
// DisassemblerX64 implementation.
ABORT_ON_UNIMPLEMENTED_OPCODE
};
+
// A new DisassemblerX64 object is created to disassemble each instruction.
// The object can only disassemble a single instruction.
class DisassemblerX64 {
return instr_len;
}
+
//------------------------------------------------------------------------------
return "";
}
+
//------------------------------------------------------------------------------
Disassembler::Disassembler(const NameConverter& converter)
return AssignEnvironment(DefineAsRegister(result));
}
+
LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) {
LOperand* input = UseRegisterAtStart(instr->value());
LMathAbs* result = new(zone()) LMathAbs(input);
}
}
+
void MacroAssembler::Set(const Operand& dst, int64_t x) {
if (is_int32(x)) {
movq(dst, Immediate(static_cast<int32_t>(x)));
return kScratchRegister;
}
+
void MacroAssembler::LoadSmiConstant(Register dst, Smi* source) {
if (emit_debug_code()) {
movq(dst,
info.GetReturnValue().Set(17);
}
+
THREADED_TEST(DirectCall) {
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
info.GetReturnValue().Set(v8::Handle<v8::Value>());
}
+
THREADED_TEST(EmptyResult) {
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
CHECK_EQ(expected, *utf8);
}
+
static void ExpectInt32(const char* code, int expected) {
Local<Value> result = CompileRun(code);
CHECK(result->IsInt32());
CHECK_EQ(expected, result->Int32Value());
}
+
static void ExpectBoolean(const char* code, bool expected) {
Local<Value> result = CompileRun(code);
CHECK(result->IsBoolean());
info.GetReturnValue().Set(v8_num(102));
}
+
static void handle_callback(const v8::FunctionCallbackInfo<Value>& info) {
return handle_callback_impl(info, FUNCTION_ADDR(handle_callback));
}
+
static void handle_callback_2(const v8::FunctionCallbackInfo<Value>& info) {
return handle_callback_impl(info, FUNCTION_ADDR(handle_callback_2));
}
return scope.Close(CompileRun("callback_object.callback()"));
}
+
THREADED_PROFILED_TEST(FastReturnValues) {
LocalContext env;
v8::HandleScope scope(v8::Isolate::GetCurrent());
info.GetReturnValue().Set(name);
}
+
// Helper functions for Interceptor/Accessor interaction tests
void SimpleAccessorGetter(Local<String> name,
templ->InstanceTemplate()->SetNamedPropertyHandler(getter, setter);
}
+
THREADED_TEST(EmptyInterceptorDoesNotShadowAccessors) {
v8::HandleScope scope(v8::Isolate::GetCurrent());
Handle<FunctionTemplate> parent = FunctionTemplate::New();
ExpectInt32("child.accessor_age", 10);
}
+
THREADED_TEST(EmptyInterceptorDoesNotShadowJSAccessors) {
v8::HandleScope scope(v8::Isolate::GetCurrent());
Handle<FunctionTemplate> parent = FunctionTemplate::New();
ExpectInt32("child.accessor_age", 10);
}
+
THREADED_TEST(EmptyInterceptorDoesNotAffectJSProperties) {
v8::HandleScope scope(v8::Isolate::GetCurrent());
Handle<FunctionTemplate> parent = FunctionTemplate::New();
ExpectString("parent.name", "Alice");
}
+
THREADED_TEST(SwitchFromInterceptorToAccessor) {
v8::HandleScope scope(v8::Isolate::GetCurrent());
Handle<FunctionTemplate> templ = FunctionTemplate::New();
ExpectInt32("obj.accessor_age", 10000);
}
+
THREADED_TEST(SwitchFromAccessorToInterceptor) {
v8::HandleScope scope(v8::Isolate::GetCurrent());
Handle<FunctionTemplate> templ = FunctionTemplate::New();
ExpectInt32("obj.interceptor_age", 9999);
}
+
THREADED_TEST(SwitchFromInterceptorToAccessorWithInheritance) {
v8::HandleScope scope(v8::Isolate::GetCurrent());
Handle<FunctionTemplate> parent = FunctionTemplate::New();
ExpectInt32("child.accessor_age", 10000);
}
+
THREADED_TEST(SwitchFromAccessorToInterceptorWithInheritance) {
v8::HandleScope scope(v8::Isolate::GetCurrent());
Handle<FunctionTemplate> parent = FunctionTemplate::New();
ExpectInt32("child.interceptor_age", 9999);
}
+
THREADED_TEST(SwitchFromInterceptorToJSAccessor) {
v8::HandleScope scope(v8::Isolate::GetCurrent());
Handle<FunctionTemplate> templ = FunctionTemplate::New();
ExpectUndefined("Object.getOwnPropertyDescriptor(obj, 'age').value");
}
+
THREADED_TEST(SwitchFromJSAccessorToInterceptor) {
v8::HandleScope scope(v8::Isolate::GetCurrent());
Handle<FunctionTemplate> templ = FunctionTemplate::New();
ExpectUndefined("Object.getOwnPropertyDescriptor(obj, 'age').value");
}
+
THREADED_TEST(SwitchFromInterceptorToProperty) {
v8::HandleScope scope(v8::Isolate::GetCurrent());
Handle<FunctionTemplate> parent = FunctionTemplate::New();
ExpectInt32("child.age", 10000);
}
+
THREADED_TEST(SwitchFromPropertyToInterceptor) {
v8::HandleScope scope(v8::Isolate::GetCurrent());
Handle<FunctionTemplate> parent = FunctionTemplate::New();
ExpectInt32("child.interceptor_age", 9999);
}
+
THREADED_TEST(NamedPropertyHandlerGetter) {
echo_named_call_count = 0;
v8::HandleScope scope(v8::Isolate::GetCurrent());
CHECK((*env)->GetEmbedderData(index)->StrictEquals(data));
}
+
THREADED_TEST(EmbedderData) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
CheckDataViewIsNeutered(dv);
}
+
THREADED_TEST(ArrayBuffer_NeuteringScript) {
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
fun->Call(fun, argc, a5);
}
+
void ThrowValue(const v8::FunctionCallbackInfo<v8::Value>& args) {
ApiTestFuzzer::Fuzz();
CHECK_EQ(1, args.Length());
}
}
+
THREADED_TEST(DefinePropertyOnAPIAccessor) {
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
CHECK_EQ(*exception_value, "TypeError: Cannot redefine property: x");
}
+
THREADED_TEST(DefinePropertyOnDefineGetterSetter) {
v8::HandleScope scope(v8::Isolate::GetCurrent());
Local<ObjectTemplate> templ = ObjectTemplate::New();
info.GetReturnValue().Set(whammy->getScript()->Run());
}
+
THREADED_TEST(WeakReference) {
v8::HandleScope handle_scope(v8::Isolate::GetCurrent());
v8::Handle<v8::ObjectTemplate> templ= v8::ObjectTemplate::New();
CHECK_EQ(" new o.foo();", *source_line);
}
+
TEST(ExceptionInNativeScript) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
args.GetReturnValue().Set(args[0]->Int32Value() + 1);
}
+
// Helper to maximize the odds of object moving.
static void GenerateSomeGarbage() {
CompileRun(
CHECK_EQ(31, p_getter_count);
}
+
THREADED_PROFILED_TEST(LoadICFastApi_DirectCall_GCMoveStub) {
LoadICFastApi_DirectCall_GCMoveStub(DirectGetterCallback);
}
CHECK_EQ(100, interceptor_call_count);
}
+
THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature) {
int interceptor_call_count = 0;
v8::HandleScope scope(v8::Isolate::GetCurrent());
CHECK_EQ(100, interceptor_call_count);
}
+
THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss1) {
int interceptor_call_count = 0;
v8::HandleScope scope(v8::Isolate::GetCurrent());
CHECK_GE(interceptor_call_count, 50);
}
+
THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss2) {
int interceptor_call_count = 0;
v8::HandleScope scope(v8::Isolate::GetCurrent());
CHECK_GE(interceptor_call_count, 50);
}
+
THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss3) {
int interceptor_call_count = 0;
v8::HandleScope scope(v8::Isolate::GetCurrent());
CHECK_GE(interceptor_call_count, 50);
}
+
THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature_TypeError) {
int interceptor_call_count = 0;
v8::HandleScope scope(v8::Isolate::GetCurrent());
CHECK_GE(interceptor_call_count, 50);
}
+
THREADED_PROFILED_TEST(CallICFastApi_TrivialSignature) {
v8::HandleScope scope(v8::Isolate::GetCurrent());
v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
CHECK_EQ(42, context->Global()->Get(v8_str("result"))->Int32Value());
}
+
THREADED_PROFILED_TEST(CallICFastApi_SimpleSignature) {
v8::HandleScope scope(v8::Isolate::GetCurrent());
v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
CHECK_EQ(42, context->Global()->Get(v8_str("result"))->Int32Value());
}
+
THREADED_PROFILED_TEST(CallICFastApi_SimpleSignature_Miss1) {
v8::HandleScope scope(v8::Isolate::GetCurrent());
v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
CHECK_EQ(42, context->Global()->Get(v8_str("saved_result"))->Int32Value());
}
+
THREADED_PROFILED_TEST(CallICFastApi_SimpleSignature_Miss2) {
v8::HandleScope scope(v8::Isolate::GetCurrent());
v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
CHECK_EQ(42, context->Global()->Get(v8_str("saved_result"))->Int32Value());
}
+
THREADED_PROFILED_TEST(CallICFastApi_SimpleSignature_TypeError) {
v8::HandleScope scope(v8::Isolate::GetCurrent());
v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
CHECK_EQ(239, context->Global()->Get(v8_str("saved_result"))->Int32Value());
}
+
// Test the map transition before the interceptor.
THREADED_TEST(InterceptorKeyedCallICMapChangeBefore) {
v8::HandleScope scope(v8::Isolate::GetCurrent());
}
}
+
// Test interceptor load/call IC where the interceptor throws an
// exception once in a while.
THREADED_TEST(InterceptorICGetterExceptions) {
}
}
+
// Test interceptor store IC where the interceptor throws an exception
// once in a while.
THREADED_TEST(InterceptorICSetterExceptions) {
message->GetScriptResourceName();
}
+
THREADED_TEST(ExceptionsDoNotPropagatePastTryCatch) {
LocalContext context;
HandleScope scope(context->GetIsolate());
ApiTestFuzzer::TearDown();
}
+
TEST(Threading2) {
ApiTestFuzzer::SetUp(ApiTestFuzzer::SECOND_PART);
ApiTestFuzzer::RunAllTests();
ApiTestFuzzer::TearDown();
}
+
TEST(Threading3) {
ApiTestFuzzer::SetUp(ApiTestFuzzer::THIRD_PART);
ApiTestFuzzer::RunAllTests();
ApiTestFuzzer::TearDown();
}
+
TEST(Threading4) {
ApiTestFuzzer::SetUp(ApiTestFuzzer::FOURTH_PART);
ApiTestFuzzer::RunAllTests();
ApiTestFuzzer::TearDown();
}
+
void ApiTestFuzzer::CallTest() {
if (kLogThreading)
printf("Start test %d\n", test_number_);
env->Exit();
}
+
void SetFunctionEntryHookTest::RunTest() {
// Work in a new isolate throughout.
v8::Isolate* isolate = v8::Isolate::New();
CheckOwnProperties(elms->Get(v8::Integer::New(3)), elmc4, elmv4);
}
+
THREADED_TEST(PropertyEnumeration2) {
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
info.GetReturnValue().SetUndefined();
}
+
TEST(ForceSet) {
force_set_get_count = 0;
force_set_set_count = 0;
CHECK_EQ(2, force_set_get_count);
}
+
TEST(ForceSetWithInterceptor) {
force_set_get_count = 0;
force_set_set_count = 0;
stack_trace->GetFrame(1));
}
+
TEST(CaptureStackTraceForUncaughtException) {
report_count = 0;
LocalContext env;
CHECK(CompileRunWithOrigin(code.start(), "url", 0, 0)->IsUndefined());
}
+
static void CreateGarbageInOldSpace() {
i::Factory* factory = i::Isolate::Current()->factory();
v8::HandleScope scope(v8::Isolate::GetCurrent());
}
}
+
// Test that idle notification can be handled and eventually returns true.
TEST(IdleNotification) {
const intptr_t MB = 1024 * 1024;
bool found_resource_[4];
};
+
TEST(VisitExternalStrings) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
return (input < 0) ? -(floor(-input)) : floor(input);
}
+
// We don't have a consistent way to write 64-bit constants syntactically, so we
// split them into two 32-bit constants and combine them programmatically.
static double DoubleFromBits(uint32_t high_bits, uint32_t low_bits) {
CHECK_EQ(0, script_origin_g.ResourceLineOffset()->Int32Value());
}
+
THREADED_TEST(FunctionGetInferredName) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
CHECK_EQ("foo.bar.baz", *v8::String::Utf8Value(f->GetInferredName()));
}
+
THREADED_TEST(ScriptLineNumber) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
++prologue_call_count;
}
+
void EpilogueCallback(v8::GCType, v8::GCCallbackFlags) {
++epilogue_call_count;
}
+
void PrologueCallbackSecond(v8::GCType, v8::GCCallbackFlags) {
++prologue_call_count_second;
}
+
void EpilogueCallbackSecond(v8::GCType, v8::GCCallbackFlags) {
++epilogue_call_count_second;
}
+
TEST(GCCallbacks) {
LocalContext context;
v8::V8::SetFailedAccessCheckCallbackFunction(NULL);
}
+
TEST(DefaultIsolateGetCurrent) {
CHECK(v8::Isolate::GetCurrent() != NULL);
v8::Isolate* isolate = v8::Isolate::GetCurrent();
printf("*** %s\n", "DefaultIsolateGetCurrent success");
}
+
TEST(IsolateNewDispose) {
v8::Isolate* current_isolate = v8::Isolate::GetCurrent();
v8::Isolate* isolate = v8::Isolate::New();
CHECK_EQ(last_message, NULL);
}
+
TEST(IsolateEnterExitDefault) {
v8::Isolate* current_isolate = v8::Isolate::GetCurrent();
CHECK(current_isolate != NULL); // Default isolate.
ExpectString("'still working 3'", "still working 3");
}
+
TEST(DisposeDefaultIsolate) {
v8::V8::SetFatalErrorHandler(StoringErrorCallback);
CHECK_NE(last_message, NULL);
}
+
TEST(RunDefaultAndAnotherIsolate) {
v8::HandleScope scope(v8::Isolate::GetCurrent());
LocalContext context;
ExpectTrue("function f() { return bar == 371; }; f()");
}
+
TEST(DisposeIsolateWhenInUse) {
v8::Isolate* isolate = v8::Isolate::New();
CHECK(isolate);
CHECK_NE(last_message, NULL);
}
+
TEST(RunTwoIsolatesOnSingleThread) {
// Run isolate 1.
v8::Isolate* isolate1 = v8::Isolate::New();
}
}
+
static int CalcFibonacci(v8::Isolate* isolate, int limit) {
v8::Isolate::Scope isolate_scope(isolate);
v8::HandleScope scope(isolate);
int result_;
};
+
TEST(MultipleIsolatesOnIndividualThreads) {
v8::Isolate* isolate1 = v8::Isolate::New();
v8::Isolate* isolate2 = v8::Isolate::New();
isolate2->Dispose();
}
+
TEST(IsolateDifferentContexts) {
v8::Isolate* isolate = v8::Isolate::New();
Local<v8::Context> context;
CHECK_EQ(thread.result(), true);
}
+
TEST(InitializeDefaultIsolateOnSecondaryThread1) {
InitializeTestHelper(InitDefaultIsolateThread::IgnoreOOM);
}
+
TEST(InitializeDefaultIsolateOnSecondaryThread2) {
InitializeTestHelper(InitDefaultIsolateThread::SetResourceConstraints);
}
+
TEST(InitializeDefaultIsolateOnSecondaryThread3) {
InitializeTestHelper(InitDefaultIsolateThread::SetFatalHandler);
}
+
TEST(InitializeDefaultIsolateOnSecondaryThread4) {
InitializeTestHelper(InitDefaultIsolateThread::SetCounterFunction);
}
+
TEST(InitializeDefaultIsolateOnSecondaryThread5) {
InitializeTestHelper(InitDefaultIsolateThread::SetCreateHistogramFunction);
}
+
TEST(InitializeDefaultIsolateOnSecondaryThread6) {
InitializeTestHelper(InitDefaultIsolateThread::SetAddHistogramSampleFunction);
}
TestRoundingMode(u32_f64, RN, (kMaxUInt + 1.0), kMaxUInt, true);
}
+
TEST(8) {
// Test VFP multi load/store with ia_w.
CcTest::InitializeVM();
args.GetReturnValue().Set(v8::Integer::New(res));
}
+
TEST(StackAlignmentForSSE2) {
CcTest::InitializeVM();
if (!CpuFeatures::IsSupported(SSE2)) return;
CHECK_EQ(2, result);
}
+
TEST(AssemblerX64StackOperations) {
OS::SetUp();
// Allocate an executable page of memory.
CHECK_EQ(2, result);
}
+
TEST(AssemblerX64ArithmeticOperations) {
OS::SetUp();
// Allocate an executable page of memory.
CHECK_EQ(5, result);
}
+
TEST(AssemblerX64ImulOperation) {
OS::SetUp();
// Allocate an executable page of memory.
CHECK_EQ(-1, result);
}
+
TEST(AssemblerX64MemoryOperands) {
OS::SetUp();
// Allocate an executable page of memory.
CHECK_EQ(3, result);
}
+
TEST(AssemblerX64ControlFlow) {
OS::SetUp();
// Allocate an executable page of memory.
CHECK_EQ(3, result);
}
+
TEST(AssemblerX64LoopImmediates) {
OS::SetUp();
// Allocate an executable page of memory.
args.GetReturnValue().Set(v8::Integer::New(res));
}
+
TEST(StackAlignmentForSSE2) {
CHECK_EQ(0, OS::ActivationFrameAlignment() % 16);
CHECK_EQ(state.ToIntegral(), state2.ToIntegral());
}
+
TEST(ExternalICStateParsing) {
State state;
state.Add(CompareNilICStub::UNDEFINED);
CHECK_EQ(stub.GetState().ToIntegral(), stub2.GetState().ToIntegral());
}
+
TEST(SettingState) {
State state;
CHECK(state.IsEmpty());
CHECK(!state.Contains(CompareNilICStub::UNDETECTABLE));
}
+
TEST(ClearState) {
State state;
state.Add(CompareNilICStub::NULL_TYPE);
CHECK(state.IsEmpty());
}
+
TEST(Generic) {
State state;
CHECK(State::Generic() != state);
CHECK_EQ(0.0, StringToDouble(&uc, " ", NO_FLAGS));
}
+
TEST(IntegerStrLiteral) {
UnicodeCache uc;
CHECK_EQ(0.0, StringToDouble(&uc, "0.0", NO_FLAGS));
CHECK_EQ(0.0, StringToDouble(&uc, "0.", ALLOW_HEX | ALLOW_OCTALS));
}
+
TEST(LongNumberStr) {
UnicodeCache uc;
CHECK_EQ(1e10, StringToDouble(&uc, "1" "0000000000", NO_FLAGS));
CHECK_EQ(4.4501477170144022721148e-308, StringToDouble(&uc, num, NO_FLAGS));
}
+
TEST(MinimumExponent) {
UnicodeCache uc;
// Same test but with different point-position.
processor.Join();
}
+
static inline i::Address ToAddress(int n) {
return reinterpret_cast<i::Address>(n);
}
return strcmp((*p1)->entry()->name(), (*p2)->entry()->name());
}
+
TEST(TickEvents) {
TestSetup test_setup;
LocalContext env;
return (result + day - 1) * DateCache::kMsPerDay;
}
+
static void CheckDST(int64_t time) {
Isolate* isolate = Isolate::Current();
DateCache* date_cache = isolate->date_cache();
const char* expr; // An expression to evaluate when a break point is hit.
v8::Handle<v8::Value> expected; // The expected result.
};
+
+
// Array of checks to do.
struct EvaluateCheck* checks = NULL;
// Source for The JavaScript function which can do the evaluation when a break
}
}
+
// Test GC during break point processing.
TEST(GCDuringBreakPointProcessing) {
break_point_hit_count = 0;
if (eventDetails.GetEvent() == v8::Break) ++debugEventCount;
}
+
// Test that the conditional breakpoints work event if code generation from
// strings is prohibited in the debugee context.
TEST(ConditionalBreakpointWithCodeGenerationDisallowed) {
}
}
+
// Test that the evaluation of expressions when a break point is hit generates
// the correct results in case code generation from strings is disallowed in the
// debugee context.
return i;
}
+
// Copies a 16-bit string to a C string by dropping the high byte of
// each character. Does not check for buffer overflow.
// Can be used in any thread. Requires string length as an input.
}
}
+
// Test that the evaluation of expressions works even from ProcessDebugMessages
// i.e. with empty stack.
TEST(DebugEvaluateWithoutStack) {
CheckDebuggerUnloaded();
}
+
static void NamedEnum(const v8::PropertyCallbackInfo<v8::Array>& info) {
v8::Handle<v8::Array> result = v8::Array::New(3);
result->Set(v8::Integer::New(0), v8::String::New("a"));
invalid_ = false; // A barrier may only be used once. Then it is invalid.
}
+
// Do not call, due to race condition with Wait().
// Could be resolved with Pthread condition variables.
ThreadBarrier::~ThreadBarrier() {
delete sem_;
}
+
void ThreadBarrier::Wait() {
lock_->Lock();
CHECK(!invalid_);
}
}
+
// A set containing enough barriers and semaphores for any of the tests.
class Barriers {
public:
return res;
}
+
/* Test MessageQueues */
/* Tests the message queues that hold debugger commands and
* response messages to the debugger. Fills queues and makes
message_queue_barriers.semaphore_1->Wait();
}
+
void MessageQueueDebuggerThread::Run() {
const int kBufferSize = 1000;
uint16_t buffer_1[kBufferSize];
CompileRun(source);
}
+
void DebuggerThread::Run() {
const int kBufSize = 1000;
uint16_t buffer[kBufSize];
debugger_thread.Join();
}
+
/* Test RecursiveBreakpoints */
/* In this test, the debugger evaluates a function with a breakpoint, after
* hitting a breakpoint in another function. We do this with both values
v8::Debug::SendCommand(buffer, AsciiToUtf16(command_8, buffer));
}
+
void TestRecursiveBreakpointsGeneric(bool global_evaluate) {
i::FLAG_debugger_auto_break = true;
breakpoints_debugger_thread.Join();
}
+
TEST(RecursiveBreakpoints) {
TestRecursiveBreakpointsGeneric(false);
}
+
TEST(RecursiveBreakpointsGlobal) {
TestRecursiveBreakpointsGeneric(true);
}
counting_message_handler_counter++;
}
+
// Test that debug messages get processed when ProcessDebugMessages is called.
TEST(ProcessDebugMessages) {
DebugLocalContext env;
CHECK_EQ(expected_callback_data, details.GetCallbackData());
}
+
// Check that event details contain context where debug event occured.
TEST(DebugEventContext) {
v8::Isolate* isolate = v8::Isolate::GetCurrent();
CHECK_EQ(1.7976931348623157e308, Double(max_double64).value());
}
+
TEST(AsDiyFp) {
uint64_t ordered = V8_2PART_UINT64_C(0x01234567, 89ABCDEF);
DiyFp diy_fp = Double(ordered).AsDiyFp();
CHECK_EQ(v8::HeapGraphNode::kHeapNumber, b->GetType());
}
+
TEST(HeapSnapshotSlicedString) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
CHECK_EQ(parent_string, parent);
}
+
TEST(HeapSnapshotInternalReferences) {
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::HandleScope scope(isolate);
CHECK_EQ_SNAPSHOT_OBJECT_ID(k1->GetId(), k2->GetId());
}
+
TEST(HeapEntryIdsAndGC) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
};
}
+
TEST(TakeHeapSnapshotAborting) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
}
};
+
TEST(GlobalObjectName) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
CHECK_NE(NULL, hidden_props);
}
+
bool HasWeakEdge(const v8::HeapGraphNode* node) {
for (int i = 0; i < node->GetChildrenCount(); ++i) {
const v8::HeapGraphEdge* handle_edge = node->GetChild(i);
}
};
+
// Check that we can add (a reference to) an element of the list
// itself.
TEST(ListAdd) {
CHECK_EQ(1, list[4]);
}
+
// Test that we can add all elements from a list to another list.
TEST(ListAddAll) {
List<int, ZeroingAllocationPolicy> list(4);
Persistent<v8::Context> context_;
};
+
// Migrates an isolate from one thread to another
TEST(KangarooIsolates) {
v8::Isolate* isolate = v8::Isolate::New();
thread1->Join();
}
+
static void CalcFibAndCheck() {
Local<Value> v = CompileRun("function fib(n) {"
" if (n <= 2) return 1;"
v8::Isolate* isolate_;
};
+
static void StartJoinAndDeleteThreads(const i::List<JoinableThread*>& threads) {
for (int i = 0; i < threads.length(); i++) {
threads[i]->Start();
private:
};
+
// Run many threads each accessing its own isolate without locking
TEST(MultithreadedParallelIsolates) {
#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS
v8::Isolate* isolate_;
};
+
// Run many threads with nested locks
TEST(IsolateNestedLocking) {
#if V8_TARGET_ARCH_MIPS
v8::Isolate* isolate2_;
};
+
// Run parallel threads that lock and access different isolates in parallel
TEST(SeparateIsolatesLocksNonexclusive) {
#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS
v8::Isolate* isolate_;
};
+
// Use unlocker inside of a Locker, multiple threads.
TEST(LockerUnlocker) {
#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS
v8::Isolate* isolate_;
};
+
// Use Unlocker inside two Lockers.
TEST(LockTwiceAndUnlock) {
#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS
v8::Isolate* isolate2_;
};
+
// Lock two isolates and unlock one of them.
TEST(LockAndUnlockDifferentIsolates) {
v8::Isolate* isolate1 = v8::Isolate::New();
v8::Persistent<v8::Context> context_;
};
+
// Locker inside an Unlocker inside a Locker.
TEST(LockUnlockLockMultithreaded) {
#if V8_TARGET_ARCH_MIPS
v8::Persistent<v8::Context> context_;
};
+
// Locker inside an Unlocker inside a Locker for default isolate.
TEST(LockUnlockLockDefaultIsolateMultithreaded) {
#if V8_TARGET_ARCH_MIPS
const char** extension_names_;
};
+
// Test installing extensions in separate isolates concurrently.
// http://code.google.com/p/v8/issues/detail?id=1821
TEST(ExtensionsRegistration) {
return code->contains(addr);
}
+
static bool IsAddressWithinFuncCode(const char* func_name, Address addr) {
v8::Local<v8::Value> func = CcTest::env()->Global()->Get(v8_str(func_name));
CHECK(func->IsFunction());
static void ObjMethod1(const v8::FunctionCallbackInfo<v8::Value>& args) {
}
+
TEST(LogCallbacks) {
ScopedLoggerInitializer initialize_logger(false);
Logger* logger = initialize_logger.logger();
const v8::PropertyCallbackInfo<v8::Value>& info) {
}
+
TEST(LogAccessorCallbacks) {
ScopedLoggerInitializer initialize_logger(false);
Logger* logger = initialize_logger.logger();
__ j(not_equal, exit);
}
+
TEST(SmiAdd) {
v8::internal::V8::Initialize(NULL);
// Allocate an executable page of memory.
}
}
+
TEST(SmiIndex) {
v8::internal::V8::Initialize(NULL);
// Allocate an executable page of memory.
handle->Dispose(isolate);
}
+
TEST(ObjectGroups) {
FLAG_incremental_marking = false;
CcTest::InitializeVM();
};
}
+
TEST(PerIsolateState) {
HarmonyIsolate isolate;
HandleScope scope(isolate.GetIsolate());
CHECK_EQ(3, CompileRun("count")->Int32Value());
}
+
TEST(EndOfMicrotaskDelivery) {
HarmonyIsolate isolate;
HandleScope scope(isolate.GetIsolate());
CHECK_EQ(1, CompileRun("count")->Int32Value());
}
+
TEST(DeliveryOrdering) {
HarmonyIsolate isolate;
HandleScope scope(isolate.GetIsolate());
CHECK_EQ(3, CompileRun("ordering[2]")->Int32Value());
}
+
TEST(DeliveryOrderingReentrant) {
HarmonyIsolate isolate;
HandleScope scope(isolate.GetIsolate());
CHECK_EQ(2, CompileRun("ordering[1]")->Int32Value());
}
+
TEST(DeliveryOrderingDeliverChangeRecords) {
HarmonyIsolate isolate;
HandleScope scope(isolate.GetIsolate());
CHECK_EQ(2, CompileRun("ordering[3]")->Int32Value());
}
+
TEST(ObjectHashTableGrowth) {
HarmonyIsolate isolate;
HandleScope scope(isolate.GetIsolate());
CHECK(CompileRun("ran")->BooleanValue());
}
+
TEST(GlobalObjectObservation) {
HarmonyIsolate isolate;
LocalContext context;
Handle<Value> old_value;
};
+
// TODO(adamk): Use this helper elsewhere in this file.
static void ExpectRecords(Handle<Value> records,
const RecordExpectation expectations[],
EXPECT_RECORDS(CompileRun("records"), expected_records);
}
+
TEST(HiddenPrototypeObservation) {
HarmonyIsolate isolate;
HandleScope scope(isolate.GetIsolate());
} while (expected_tokens[i] != i::Token::ILLEGAL);
}
+
TEST(StreamScanner) {
v8::V8::Initialize();
return reinterpret_cast<void*>(static_cast<intptr_t>(num + 1));
}
+
static void DoTest() {
for (int i = 0; i < kValueCount; i++) {
CHECK(!Thread::HasThreadLocal(keys[i]));
}
};
+
TEST(FastTLS) {
for (int i = 0; i < kValueCount; i++) {
keys[i] = Thread::CreateThreadLocalKey();
args.GetReturnValue().Set(v8_num(sp_addr));
}
+
TEST(StackAlignment) {
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::HandleScope handle_scope(isolate);
return reinterpret_cast<i::Address>(n);
}
+
TEST(CodeMapAddCode) {
CodeMap code_map;
CodeEntry entry1(i::Logger::FUNCTION_TAG, "aaa");
}
}
+
TEST(SampleIds) {
TestSetup test_setup;
CpuProfilesCollection profiles;
return output;
}
+
static bool CheckSimple(const char* input) {
V8::Initialize(NULL);
v8::HandleScope scope(v8::Isolate::GetCurrent());
int max_match;
};
+
static MinMaxPair CheckMinMaxMatch(const char* input) {
V8::Initialize(NULL);
v8::HandleScope scope(v8::Isolate::GetCurrent());
CHECK_MIN_MAX("a(?!bbb|bb)c", 2, 2);
}
+
TEST(ParserRegression) {
CHECK_PARSE_EQ("[A-Z$-][x]", "(! [A-Z $ -] [x])");
CHECK_PARSE_EQ("a{3,4*}", "(: 'a{3,' (# 0 - g '4') '}')");
}
}
+
// Test of debug-only syntax.
#ifdef DEBUG
v8::Script::Compile(source)->Run();
}
+
void ReenterAfterTermination(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::TryCatch try_catch;
CHECK(!v8::V8::IsExecutionTerminating());
v8::Script::Compile(v8::String::New("function f() { fail(); } f()"))->Run();
}
+
// Test that reentry into V8 while the termination exception is still pending
// (has not yet unwound the 0-level JS frame) does not crash.
TEST(TerminateAndReenterFromThreadItself) {
"f()"))->Run()->IsTrue());
}
+
void DoLoopCancelTerminate(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::TryCatch try_catch;
CHECK(!v8::V8::IsExecutionTerminating());
CHECK(!v8::V8::IsExecutionTerminating());
}
+
// Test that a single thread of JavaScript execution can terminate
// itself and then resume execution.
TEST(TerminateCancelTerminateFromThreadItself) {
i::Semaphore* semaphore_;
};
+
TEST(ThreadIdValidation) {
const int kNThreads = 100;
i::List<ThreadIdValidationThread*> threads(kNThreads);
CHECK(type2->Is(type1));
}
+
static void CheckSub(Handle<Type> type1, Handle<Type> type2) {
CHECK(type1->Is(type2));
CHECK(!type2->Is(type1));
}
}
+
static void CheckUnordered(Handle<Type> type1, Handle<Type> type2) {
CHECK(!type1->Is(type2));
CHECK(!type2->Is(type1));
}
}
+
static void CheckOverlap(Handle<Type> type1, Handle<Type> type2) {
CHECK(type1->Maybe(type2));
CHECK(type2->Maybe(type1));
}
}
+
static void CheckDisjoint(Handle<Type> type1, Handle<Type> type2) {
CHECK(!type1->Is(type2));
CHECK(!type2->Is(type1));
int* a_;
};
+
void DumpHeapStats(const char *minidump_file) {
Minidump minidump(minidump_file);
CHECK(minidump.Read());
'gnuplot-4.6.3-emscripten.js']
IGNORE_TABS = IGNORE_COPYRIGHTS + ['unicode-test.js', 'html-comments.js']
+ def EndOfDeclaration(self, line):
+ return line == "}" or line == "};"
+
+ def StartOfDeclaration(self, line):
+ return line.find("//") == 0 or \
+ line.find("/*") == 0 or \
+ line.find(") {") != -1
+
def ProcessContents(self, name, contents):
result = True
base = basename(name)
if not COPYRIGHT_HEADER_PATTERN.search(contents):
print "%s is missing a correct copyright header." % name
result = False
- ext = base.split('.').pop()
if ' \n' in contents or contents.endswith(' '):
line = 0
lines = []
else:
print "%s has trailing whitespaces in line %s." % (name, linenumbers)
result = False
+ # Check two empty lines between declarations.
+ if name.endswith(".cc"):
+ line = 0
+ lines = []
+ parts = contents.split('\n')
+ while line < len(parts) - 2:
+ if self.EndOfDeclaration(parts[line]):
+ if self.StartOfDeclaration(parts[line + 1]):
+ lines.append(str(line + 1))
+ line += 1
+ elif parts[line + 1] == "" and \
+ self.StartOfDeclaration(parts[line + 2]):
+ lines.append(str(line + 1))
+ line += 2
+ line += 1
+ if len(lines) >= 1:
+ linenumbers = ', '.join(lines)
+ if len(lines) > 1:
+ print "%s does not have two empty lines between declarations " \
+ "in lines %s." % (name, linenumbers)
+ else:
+ print "%s does not have two empty lines between declarations " \
+ "in line %s." % (name, linenumbers)
+ result = False
return result
def ProcessFiles(self, files, path):
print "Running C++ lint check..."
if not options.no_lint:
success = CppLintProcessor().Run(workspace) and success
- print "Running copyright header and trailing whitespaces check..."
+ print "Running copyright header, trailing whitespaces and " \
+ "two empty lines between declarations check..."
success = SourceProcessor().Run(workspace) and success
if success:
return 0