diff --git a/deps/v8/ChangeLog b/deps/v8/ChangeLog index ad57e3317d..7e7df06809 100644 --- a/deps/v8/ChangeLog +++ b/deps/v8/ChangeLog @@ -1,3 +1,36 @@ +2011-07-13: Version 3.4.12 + + Added --prof profiling option to d8 shell. + + Fixed a bug where reading a directory in d8 shell hangs (issue 1533). + + Fixed a potential assertion failure in const declarations. + + Fixed an assertion failure in descriptor arrays (issue 1526). + + Enabled fast thread-local storage by default on supported platforms. + + Improved reporting of source position for global variable loads + (issue 1527). + + +2011-07-11: Version 3.4.11 + + Fixed MinGW32 build. + + Fixed a GC bug with RegExp code flushing. + + Implemented Object.defineProperty for proxies. + + Fixed a bug in for/in iteration of arguments objects (issue 1531). + + Added debugger support for inspecting optimized frames (issue 1140). + + Allowed JSObject::PreventExtensions to work for arguments objects. + + Bugfixes and performance work. + + 2011-07-06: Version 3.4.10 Fixed debugger not breaking on certain "if" statements (issue 1523). @@ -36,7 +69,7 @@ Ensure 16-byte stack alignment on Solaris (issue 1505). - Fix "illegal access" when calling parseInt with a radix + Fix "illegal access" when calling parseInt with a radix that is not a smi. (issue 1246). diff --git a/deps/v8/SConstruct b/deps/v8/SConstruct index d8d41c08ea..5276ce2cae 100644 --- a/deps/v8/SConstruct +++ b/deps/v8/SConstruct @@ -60,26 +60,17 @@ LIBRARY_FLAGS = { 'mode:debug': { 'CPPDEFINES': ['V8_ENABLE_CHECKS', 'OBJECT_PRINT'] }, - 'vmstate:on': { - 'CPPDEFINES': ['ENABLE_VMSTATE_TRACKING'], - }, 'objectprint:on': { 'CPPDEFINES': ['OBJECT_PRINT'], }, - 'protectheap:on': { - 'CPPDEFINES': ['ENABLE_VMSTATE_TRACKING', 'ENABLE_HEAP_PROTECTION'], - }, - 'profilingsupport:on': { - 'CPPDEFINES': ['ENABLE_VMSTATE_TRACKING', 'ENABLE_LOGGING_AND_PROFILING'], - }, 'debuggersupport:on': { 'CPPDEFINES': ['ENABLE_DEBUGGER_SUPPORT'], }, 'inspector:on': { 'CPPDEFINES': ['INSPECTOR'], }, - 'fasttls:on': { - 'CPPDEFINES': ['V8_FAST_TLS'], + 'fasttls:off': { + 'CPPDEFINES': ['V8_NO_FAST_TLS'], }, 'liveobjectlist:on': { 'CPPDEFINES': ['ENABLE_DEBUGGER_SUPPORT', 'INSPECTOR', @@ -929,21 +920,11 @@ SIMPLE_OPTIONS = { 'default': 'static', 'help': 'the type of library to produce' }, - 'vmstate': { - 'values': ['on', 'off'], - 'default': 'off', - 'help': 'enable VM state tracking' - }, 'objectprint': { 'values': ['on', 'off'], 'default': 'off', 'help': 'enable object printing' }, - 'protectheap': { - 'values': ['on', 'off'], - 'default': 'off', - 'help': 'enable heap protection' - }, 'profilingsupport': { 'values': ['on', 'off'], 'default': 'on', diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h index fb10c71576..0872411067 100644 --- a/deps/v8/include/v8.h +++ b/deps/v8/include/v8.h @@ -2983,31 +2983,6 @@ class V8EXPORT V8 { */ static bool IsProfilerPaused(); - /** - * If logging is performed into a memory buffer (via --logfile=*), allows to - * retrieve previously written messages. This can be used for retrieving - * profiler log data in the application. This function is thread-safe. - * - * Caller provides a destination buffer that must exist during GetLogLines - * call. Only whole log lines are copied into the buffer. - * - * \param from_pos specified a point in a buffer to read from, 0 is the - * beginning of a buffer. It is assumed that caller updates its current - * position using returned size value from the previous call. - * \param dest_buf destination buffer for log data. - * \param max_size size of the destination buffer. - * \returns actual size of log data copied into buffer. - */ - static int GetLogLines(int from_pos, char* dest_buf, int max_size); - - /** - * The minimum allowed size for a log lines buffer. If the size of - * the buffer given will not be enough to hold a line of the maximum - * length, an attempt to find a log line end in GetLogLines will - * fail, and an empty result will be returned. - */ - static const int kMinimumSizeForLogLinesBuffer = 2048; - /** * Retrieve the V8 thread id of the calling thread. * diff --git a/deps/v8/src/SConscript b/deps/v8/src/SConscript index 4b0ba16341..6b3059aea6 100755 --- a/deps/v8/src/SConscript +++ b/deps/v8/src/SConscript @@ -231,15 +231,11 @@ SOURCES = { PREPARSER_SOURCES = { 'all': Split(""" allocation.cc - bignum.cc - cached-powers.cc - conversions.cc hashmap.cc preparse-data.cc preparser.cc preparser-api.cc scanner-base.cc - strtod.cc token.cc unicode.cc utils.cc @@ -317,10 +313,7 @@ def ConfigureObjectFiles(): env.Replace(**context.flags['v8']) context.ApplyEnvOverrides(env) env['BUILDERS']['JS2C'] = Builder(action=js2c.JS2C) - if 'ENABLE_LOGGING_AND_PROFILING' in env['CPPDEFINES']: - env['BUILDERS']['Snapshot'] = Builder(action='$SOURCE $TARGET --logfile "$LOGFILE" --log-snapshot-positions') - else: - env['BUILDERS']['Snapshot'] = Builder(action='$SOURCE $TARGET') + env['BUILDERS']['Snapshot'] = Builder(action='$SOURCE $TARGET --logfile "$LOGFILE" --log-snapshot-positions') def BuildJS2CEnv(type): js2c_env = { 'TYPE': type, 'COMPRESSION': 'off' } diff --git a/deps/v8/src/api.cc b/deps/v8/src/api.cc index 71a715c1bb..dc1f90c0e2 100644 --- a/deps/v8/src/api.cc +++ b/deps/v8/src/api.cc @@ -54,16 +54,11 @@ #define LOG_API(isolate, expr) LOG(isolate, ApiEntryCall(expr)) -#ifdef ENABLE_VMSTATE_TRACKING #define ENTER_V8(isolate) \ ASSERT((isolate)->IsInitialized()); \ i::VMState __state__((isolate), i::OTHER) #define LEAVE_V8(isolate) \ i::VMState __state__((isolate), i::EXTERNAL) -#else -#define ENTER_V8(isolate) ((void) 0) -#define LEAVE_V8(isolate) ((void) 0) -#endif namespace v8 { @@ -114,9 +109,7 @@ namespace v8 { static void DefaultFatalErrorHandler(const char* location, const char* message) { -#ifdef ENABLE_VMSTATE_TRACKING i::VMState __state__(i::Isolate::Current(), i::OTHER); -#endif API_Fatal(location, message); } @@ -4832,37 +4825,20 @@ void V8::RemoveMemoryAllocationCallback(MemoryAllocationCallback callback) { void V8::PauseProfiler() { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); isolate->logger()->PauseProfiler(); -#endif } void V8::ResumeProfiler() { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); isolate->logger()->ResumeProfiler(); -#endif } bool V8::IsProfilerPaused() { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); return isolate->logger()->IsProfilerPaused(); -#else - return true; -#endif -} - - -int V8::GetLogLines(int from_pos, char* dest_buf, int max_size) { -#ifdef ENABLE_LOGGING_AND_PROFILING - ASSERT(max_size >= kMinimumSizeForLogLinesBuffer); - return LOGGER->GetLogLines(from_pos, dest_buf, max_size); -#endif - return 0; } @@ -5327,7 +5303,6 @@ Local Debug::GetDebugContext() { Handle CpuProfileNode::GetFunctionName() const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::CpuProfileNode::GetFunctionName"); const i::ProfileNode* node = reinterpret_cast(this); @@ -5340,117 +5315,77 @@ Handle CpuProfileNode::GetFunctionName() const { isolate->factory()->LookupAsciiSymbol(entry->name_prefix()), isolate->factory()->LookupAsciiSymbol(entry->name())))); } -#else - return v8::String::Empty(); -#endif } Handle CpuProfileNode::GetScriptResourceName() const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::CpuProfileNode::GetScriptResourceName"); const i::ProfileNode* node = reinterpret_cast(this); return Handle(ToApi(isolate->factory()->LookupAsciiSymbol( node->entry()->resource_name()))); -#else - return v8::String::Empty(); -#endif } int CpuProfileNode::GetLineNumber() const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::CpuProfileNode::GetLineNumber"); return reinterpret_cast(this)->entry()->line_number(); -#else - return 0; -#endif } double CpuProfileNode::GetTotalTime() const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::CpuProfileNode::GetTotalTime"); return reinterpret_cast(this)->GetTotalMillis(); -#else - return 0.0; -#endif } double CpuProfileNode::GetSelfTime() const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::CpuProfileNode::GetSelfTime"); return reinterpret_cast(this)->GetSelfMillis(); -#else - return 0.0; -#endif } double CpuProfileNode::GetTotalSamplesCount() const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::CpuProfileNode::GetTotalSamplesCount"); return reinterpret_cast(this)->total_ticks(); -#else - return 0.0; -#endif } double CpuProfileNode::GetSelfSamplesCount() const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::CpuProfileNode::GetSelfSamplesCount"); return reinterpret_cast(this)->self_ticks(); -#else - return 0.0; -#endif } unsigned CpuProfileNode::GetCallUid() const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::CpuProfileNode::GetCallUid"); return reinterpret_cast(this)->entry()->GetCallUid(); -#else - return 0; -#endif } int CpuProfileNode::GetChildrenCount() const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::CpuProfileNode::GetChildrenCount"); return reinterpret_cast(this)->children()->length(); -#else - return 0; -#endif } const CpuProfileNode* CpuProfileNode::GetChild(int index) const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::CpuProfileNode::GetChild"); const i::ProfileNode* child = reinterpret_cast(this)->children()->at(index); return reinterpret_cast(child); -#else - return NULL; -#endif } void CpuProfile::Delete() { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::CpuProfile::Delete"); i::CpuProfiler::DeleteProfile(reinterpret_cast(this)); @@ -5459,153 +5394,109 @@ void CpuProfile::Delete() { // If this was the last profile, clean up all accessory data as well. i::CpuProfiler::DeleteAllProfiles(); } -#endif } unsigned CpuProfile::GetUid() const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::CpuProfile::GetUid"); return reinterpret_cast(this)->uid(); -#else - return 0; -#endif } Handle CpuProfile::GetTitle() const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::CpuProfile::GetTitle"); const i::CpuProfile* profile = reinterpret_cast(this); return Handle(ToApi(isolate->factory()->LookupAsciiSymbol( profile->title()))); -#else - return v8::String::Empty(); -#endif } const CpuProfileNode* CpuProfile::GetBottomUpRoot() const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::CpuProfile::GetBottomUpRoot"); const i::CpuProfile* profile = reinterpret_cast(this); return reinterpret_cast(profile->bottom_up()->root()); -#else - return NULL; -#endif } const CpuProfileNode* CpuProfile::GetTopDownRoot() const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::CpuProfile::GetTopDownRoot"); const i::CpuProfile* profile = reinterpret_cast(this); return reinterpret_cast(profile->top_down()->root()); -#else - return NULL; -#endif } int CpuProfiler::GetProfilesCount() { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::CpuProfiler::GetProfilesCount"); return i::CpuProfiler::GetProfilesCount(); -#else - return 0; -#endif } const CpuProfile* CpuProfiler::GetProfile(int index, Handle security_token) { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::CpuProfiler::GetProfile"); return reinterpret_cast( i::CpuProfiler::GetProfile( security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token), index)); -#else - return NULL; -#endif } const CpuProfile* CpuProfiler::FindProfile(unsigned uid, Handle security_token) { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::CpuProfiler::FindProfile"); return reinterpret_cast( i::CpuProfiler::FindProfile( security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token), uid)); -#else - return NULL; -#endif } void CpuProfiler::StartProfiling(Handle title) { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::CpuProfiler::StartProfiling"); i::CpuProfiler::StartProfiling(*Utils::OpenHandle(*title)); -#endif } const CpuProfile* CpuProfiler::StopProfiling(Handle title, Handle security_token) { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::CpuProfiler::StopProfiling"); return reinterpret_cast( i::CpuProfiler::StopProfiling( security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token), *Utils::OpenHandle(*title))); -#else - return NULL; -#endif } void CpuProfiler::DeleteAllProfiles() { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::CpuProfiler::DeleteAllProfiles"); i::CpuProfiler::DeleteAllProfiles(); -#endif } -#ifdef ENABLE_LOGGING_AND_PROFILING static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) { return const_cast( reinterpret_cast(edge)); } -#endif HeapGraphEdge::Type HeapGraphEdge::GetType() const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::HeapGraphEdge::GetType"); return static_cast(ToInternal(this)->type()); -#else - return static_cast(0); -#endif } Handle HeapGraphEdge::GetName() const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::HeapGraphEdge::GetName"); i::HeapGraphEdge* edge = ToInternal(this); @@ -5622,166 +5513,112 @@ Handle HeapGraphEdge::GetName() const { edge->index()))); default: UNREACHABLE(); } -#endif return v8::Undefined(); } const HeapGraphNode* HeapGraphEdge::GetFromNode() const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::HeapGraphEdge::GetFromNode"); const i::HeapEntry* from = ToInternal(this)->From(); return reinterpret_cast(from); -#else - return NULL; -#endif } const HeapGraphNode* HeapGraphEdge::GetToNode() const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::HeapGraphEdge::GetToNode"); const i::HeapEntry* to = ToInternal(this)->to(); return reinterpret_cast(to); -#else - return NULL; -#endif } -#ifdef ENABLE_LOGGING_AND_PROFILING static i::HeapEntry* ToInternal(const HeapGraphNode* entry) { return const_cast( reinterpret_cast(entry)); } -#endif HeapGraphNode::Type HeapGraphNode::GetType() const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::HeapGraphNode::GetType"); return static_cast(ToInternal(this)->type()); -#else - return static_cast(0); -#endif } Handle HeapGraphNode::GetName() const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::HeapGraphNode::GetName"); return Handle(ToApi(isolate->factory()->LookupAsciiSymbol( ToInternal(this)->name()))); -#else - return v8::String::Empty(); -#endif } uint64_t HeapGraphNode::GetId() const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::HeapGraphNode::GetId"); return ToInternal(this)->id(); -#else - return 0; -#endif } int HeapGraphNode::GetSelfSize() const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::HeapGraphNode::GetSelfSize"); return ToInternal(this)->self_size(); -#else - return 0; -#endif } int HeapGraphNode::GetRetainedSize(bool exact) const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::HeapSnapshot::GetRetainedSize"); return ToInternal(this)->RetainedSize(exact); -#else - return 0; -#endif } int HeapGraphNode::GetChildrenCount() const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::HeapSnapshot::GetChildrenCount"); return ToInternal(this)->children().length(); -#else - return 0; -#endif } const HeapGraphEdge* HeapGraphNode::GetChild(int index) const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::HeapSnapshot::GetChild"); return reinterpret_cast( &ToInternal(this)->children()[index]); -#else - return NULL; -#endif } int HeapGraphNode::GetRetainersCount() const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::HeapSnapshot::GetRetainersCount"); return ToInternal(this)->retainers().length(); -#else - return 0; -#endif } const HeapGraphEdge* HeapGraphNode::GetRetainer(int index) const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::HeapSnapshot::GetRetainer"); return reinterpret_cast( ToInternal(this)->retainers()[index]); -#else - return NULL; -#endif } const HeapGraphNode* HeapGraphNode::GetDominatorNode() const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::HeapSnapshot::GetDominatorNode"); return reinterpret_cast(ToInternal(this)->dominator()); -#else - return NULL; -#endif } -#ifdef ENABLE_LOGGING_AND_PROFILING static i::HeapSnapshot* ToInternal(const HeapSnapshot* snapshot) { return const_cast( reinterpret_cast(snapshot)); } -#endif void HeapSnapshot::Delete() { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::HeapSnapshot::Delete"); if (i::HeapProfiler::GetSnapshotsCount() > 1) { @@ -5790,93 +5627,63 @@ void HeapSnapshot::Delete() { // If this is the last snapshot, clean up all accessory data as well. i::HeapProfiler::DeleteAllSnapshots(); } -#endif } HeapSnapshot::Type HeapSnapshot::GetType() const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::HeapSnapshot::GetType"); return static_cast(ToInternal(this)->type()); -#else - return static_cast(0); -#endif } unsigned HeapSnapshot::GetUid() const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::HeapSnapshot::GetUid"); return ToInternal(this)->uid(); -#else - return 0; -#endif } Handle HeapSnapshot::GetTitle() const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::HeapSnapshot::GetTitle"); return Handle(ToApi(isolate->factory()->LookupAsciiSymbol( ToInternal(this)->title()))); -#else - return v8::String::Empty(); -#endif } const HeapGraphNode* HeapSnapshot::GetRoot() const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::HeapSnapshot::GetHead"); return reinterpret_cast(ToInternal(this)->root()); -#else - return 0; -#endif } const HeapGraphNode* HeapSnapshot::GetNodeById(uint64_t id) const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::HeapSnapshot::GetNodeById"); return reinterpret_cast( ToInternal(this)->GetEntryById(id)); -#else - return NULL; -#endif } int HeapSnapshot::GetNodesCount() const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::HeapSnapshot::GetNodesCount"); return ToInternal(this)->entries()->length(); -#else - return 0; -#endif } const HeapGraphNode* HeapSnapshot::GetNode(int index) const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::HeapSnapshot::GetNode"); return reinterpret_cast( ToInternal(this)->entries()->at(index)); -#else - return 0; -#endif } void HeapSnapshot::Serialize(OutputStream* stream, HeapSnapshot::SerializationFormat format) const { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::HeapSnapshot::Serialize"); ApiCheck(format == kJSON, @@ -5890,49 +5697,35 @@ void HeapSnapshot::Serialize(OutputStream* stream, "Invalid stream chunk size"); i::HeapSnapshotJSONSerializer serializer(ToInternal(this)); serializer.Serialize(stream); -#endif } int HeapProfiler::GetSnapshotsCount() { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::HeapProfiler::GetSnapshotsCount"); return i::HeapProfiler::GetSnapshotsCount(); -#else - return 0; -#endif } const HeapSnapshot* HeapProfiler::GetSnapshot(int index) { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::HeapProfiler::GetSnapshot"); return reinterpret_cast( i::HeapProfiler::GetSnapshot(index)); -#else - return NULL; -#endif } const HeapSnapshot* HeapProfiler::FindSnapshot(unsigned uid) { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::HeapProfiler::FindSnapshot"); return reinterpret_cast( i::HeapProfiler::FindSnapshot(uid)); -#else - return NULL; -#endif } const HeapSnapshot* HeapProfiler::TakeSnapshot(Handle title, HeapSnapshot::Type type, ActivityControl* control) { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::HeapProfiler::TakeSnapshot"); i::HeapSnapshot::Type internal_type = i::HeapSnapshot::kFull; @@ -5946,27 +5739,20 @@ const HeapSnapshot* HeapProfiler::TakeSnapshot(Handle title, return reinterpret_cast( i::HeapProfiler::TakeSnapshot( *Utils::OpenHandle(*title), internal_type, control)); -#else - return NULL; -#endif } void HeapProfiler::DeleteAllSnapshots() { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::HeapProfiler::DeleteAllSnapshots"); i::HeapProfiler::DeleteAllSnapshots(); -#endif } void HeapProfiler::DefineWrapperClass(uint16_t class_id, WrapperInfoCallback callback) { -#ifdef ENABLE_LOGGING_AND_PROFILING i::Isolate::Current()->heap_profiler()->DefineWrapperClass(class_id, callback); -#endif } diff --git a/deps/v8/src/arm/code-stubs-arm.cc b/deps/v8/src/arm/code-stubs-arm.cc index 94572c92e9..ab7c6f247a 100644 --- a/deps/v8/src/arm/code-stubs-arm.cc +++ b/deps/v8/src/arm/code-stubs-arm.cc @@ -304,12 +304,6 @@ class ConvertToDoubleStub : public CodeStub { } void Generate(MacroAssembler* masm); - - const char* GetName() { return "ConvertToDoubleStub"; } - -#ifdef DEBUG - void Print() { PrintF("ConvertToDoubleStub\n"); } -#endif }; @@ -1689,25 +1683,17 @@ void ToBooleanStub::Generate(MacroAssembler* masm) { } -const char* UnaryOpStub::GetName() { - if (name_ != NULL) return name_; - const int kMaxNameLength = 100; - name_ = Isolate::Current()->bootstrapper()->AllocateAutoDeletedArray( - kMaxNameLength); - if (name_ == NULL) return "OOM"; +void UnaryOpStub::PrintName(StringStream* stream) { const char* op_name = Token::Name(op_); const char* overwrite_name = NULL; // Make g++ happy. switch (mode_) { case UNARY_NO_OVERWRITE: overwrite_name = "Alloc"; break; case UNARY_OVERWRITE: overwrite_name = "Overwrite"; break; } - - OS::SNPrintF(Vector(name_, kMaxNameLength), - "UnaryOpStub_%s_%s_%s", - op_name, - overwrite_name, - UnaryOpIC::GetName(operand_type_)); - return name_; + stream->Add("UnaryOpStub_%s_%s_%s", + op_name, + overwrite_name, + UnaryOpIC::GetName(operand_type_)); } @@ -2043,12 +2029,7 @@ void BinaryOpStub::Generate(MacroAssembler* masm) { } -const char* BinaryOpStub::GetName() { - if (name_ != NULL) return name_; - const int kMaxNameLength = 100; - name_ = Isolate::Current()->bootstrapper()->AllocateAutoDeletedArray( - kMaxNameLength); - if (name_ == NULL) return "OOM"; +void BinaryOpStub::PrintName(StringStream* stream) { const char* op_name = Token::Name(op_); const char* overwrite_name; switch (mode_) { @@ -2057,13 +2038,10 @@ const char* BinaryOpStub::GetName() { case OVERWRITE_LEFT: overwrite_name = "OverwriteLeft"; break; default: overwrite_name = "UnknownOverwrite"; break; } - - OS::SNPrintF(Vector(name_, kMaxNameLength), - "BinaryOpStub_%s_%s_%s", - op_name, - overwrite_name, - BinaryOpIC::GetName(operands_type_)); - return name_; + stream->Add("BinaryOpStub_%s_%s_%s", + op_name, + overwrite_name, + BinaryOpIC::GetName(operands_type_)); } @@ -3568,7 +3546,6 @@ void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { // Setup frame pointer for the frame to be pushed. __ add(fp, sp, Operand(-EntryFrameConstants::kCallerFPOffset)); -#ifdef ENABLE_LOGGING_AND_PROFILING // If this is the outermost JS call, set js_entry_sp value. Label non_outermost_js; ExternalReference js_entry_sp(Isolate::k_js_entry_sp_address, isolate); @@ -3584,7 +3561,6 @@ void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { __ mov(ip, Operand(Smi::FromInt(StackFrame::INNER_JSENTRY_FRAME))); __ bind(&cont); __ push(ip); -#endif // Call a faked try-block that does the invoke. __ bl(&invoke); @@ -3645,7 +3621,6 @@ void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { __ PopTryHandler(); __ bind(&exit); // r0 holds result -#ifdef ENABLE_LOGGING_AND_PROFILING // Check if the current stack frame is marked as the outermost JS frame. Label non_outermost_js_2; __ pop(r5); @@ -3655,7 +3630,6 @@ void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { __ mov(r5, Operand(ExternalReference(js_entry_sp))); __ str(r6, MemOperand(r5)); __ bind(&non_outermost_js_2); -#endif // Restore the top frame descriptors from the stack. __ pop(r3); @@ -4755,16 +4729,9 @@ void CallFunctionStub::Generate(MacroAssembler* masm) { // Unfortunately you have to run without snapshots to see most of these // names in the profile since most compare stubs end up in the snapshot. -const char* CompareStub::GetName() { +void CompareStub::PrintName(StringStream* stream) { ASSERT((lhs_.is(r0) && rhs_.is(r1)) || (lhs_.is(r1) && rhs_.is(r0))); - - if (name_ != NULL) return name_; - const int kMaxNameLength = 100; - name_ = Isolate::Current()->bootstrapper()->AllocateAutoDeletedArray( - kMaxNameLength); - if (name_ == NULL) return "OOM"; - const char* cc_name; switch (cc_) { case lt: cc_name = "LT"; break; @@ -4775,40 +4742,14 @@ const char* CompareStub::GetName() { case ne: cc_name = "NE"; break; default: cc_name = "UnknownCondition"; break; } - - const char* lhs_name = lhs_.is(r0) ? "_r0" : "_r1"; - const char* rhs_name = rhs_.is(r0) ? "_r0" : "_r1"; - - const char* strict_name = ""; - if (strict_ && (cc_ == eq || cc_ == ne)) { - strict_name = "_STRICT"; - } - - const char* never_nan_nan_name = ""; - if (never_nan_nan_ && (cc_ == eq || cc_ == ne)) { - never_nan_nan_name = "_NO_NAN"; - } - - const char* include_number_compare_name = ""; - if (!include_number_compare_) { - include_number_compare_name = "_NO_NUMBER"; - } - - const char* include_smi_compare_name = ""; - if (!include_smi_compare_) { - include_smi_compare_name = "_NO_SMI"; - } - - OS::SNPrintF(Vector(name_, kMaxNameLength), - "CompareStub_%s%s%s%s%s%s", - cc_name, - lhs_name, - rhs_name, - strict_name, - never_nan_nan_name, - include_number_compare_name, - include_smi_compare_name); - return name_; + bool is_equality = cc_ == eq || cc_ == ne; + stream->Add("CompareStub_%s", cc_name); + stream->Add(lhs_.is(r0) ? "_r0" : "_r1"); + stream->Add(rhs_.is(r0) ? "_r0" : "_r1"); + if (strict_ && is_equality) stream->Add("_STRICT"); + if (never_nan_nan_ && is_equality) stream->Add("_NO_NAN"); + if (!include_number_compare_) stream->Add("_NO_NUMBER"); + if (!include_smi_compare_) stream->Add("_NO_SMI"); } diff --git a/deps/v8/src/arm/code-stubs-arm.h b/deps/v8/src/arm/code-stubs-arm.h index 7427351308..557f7e6d41 100644 --- a/deps/v8/src/arm/code-stubs-arm.h +++ b/deps/v8/src/arm/code-stubs-arm.h @@ -65,8 +65,7 @@ class UnaryOpStub: public CodeStub { UnaryOpIC::TypeInfo operand_type = UnaryOpIC::UNINITIALIZED) : op_(op), mode_(mode), - operand_type_(operand_type), - name_(NULL) { + operand_type_(operand_type) { } private: @@ -76,19 +75,7 @@ class UnaryOpStub: public CodeStub { // Operand type information determined at runtime. UnaryOpIC::TypeInfo operand_type_; - char* name_; - - const char* GetName(); - -#ifdef DEBUG - void Print() { - PrintF("UnaryOpStub %d (op %s), (mode %d, runtime_type_info %s)\n", - MinorKey(), - Token::String(op_), - static_cast(mode_), - UnaryOpIC::GetName(operand_type_)); - } -#endif + virtual void PrintName(StringStream* stream); class ModeBits: public BitField {}; class OpBits: public BitField {}; @@ -142,8 +129,7 @@ class BinaryOpStub: public CodeStub { : op_(op), mode_(mode), operands_type_(BinaryOpIC::UNINITIALIZED), - result_type_(BinaryOpIC::UNINITIALIZED), - name_(NULL) { + result_type_(BinaryOpIC::UNINITIALIZED) { use_vfp3_ = CpuFeatures::IsSupported(VFP3); ASSERT(OpBits::is_valid(Token::NUM_TOKENS)); } @@ -156,8 +142,7 @@ class BinaryOpStub: public CodeStub { mode_(ModeBits::decode(key)), use_vfp3_(VFP3Bits::decode(key)), operands_type_(operands_type), - result_type_(result_type), - name_(NULL) { } + result_type_(result_type) { } private: enum SmiCodeGenerateHeapNumberResults { @@ -173,20 +158,7 @@ class BinaryOpStub: public CodeStub { BinaryOpIC::TypeInfo operands_type_; BinaryOpIC::TypeInfo result_type_; - char* name_; - - const char* GetName(); - -#ifdef DEBUG - void Print() { - PrintF("BinaryOpStub %d (op %s), " - "(mode %d, runtime_type_info %s)\n", - MinorKey(), - Token::String(op_), - static_cast(mode_), - BinaryOpIC::GetName(operands_type_)); - } -#endif + virtual void PrintName(StringStream* stream); // Minor key encoding in 16 bits RRRTTTVOOOOOOOMM. class ModeBits: public BitField {}; @@ -370,12 +342,6 @@ class WriteInt32ToHeapNumberStub : public CodeStub { } void Generate(MacroAssembler* masm); - - const char* GetName() { return "WriteInt32ToHeapNumberStub"; } - -#ifdef DEBUG - void Print() { PrintF("WriteInt32ToHeapNumberStub\n"); } -#endif }; @@ -402,8 +368,6 @@ class NumberToStringStub: public CodeStub { int MinorKey() { return 0; } void Generate(MacroAssembler* masm); - - const char* GetName() { return "NumberToStringStub"; } }; @@ -421,8 +385,6 @@ class RegExpCEntryStub: public CodeStub { int MinorKey() { return 0; } bool NeedsImmovableCode() { return true; } - - const char* GetName() { return "RegExpCEntryStub"; } }; @@ -443,8 +405,6 @@ class DirectCEntryStub: public CodeStub { int MinorKey() { return 0; } bool NeedsImmovableCode() { return true; } - - const char* GetName() { return "DirectCEntryStub"; } }; @@ -627,13 +587,6 @@ class StringDictionaryLookupStub: public CodeStub { StringDictionary::kHeaderSize + StringDictionary::kElementsStartIndex * kPointerSize; - -#ifdef DEBUG - void Print() { - PrintF("StringDictionaryLookupStub\n"); - } -#endif - Major MajorKey() { return StringDictionaryNegativeLookup; } int MinorKey() { diff --git a/deps/v8/src/arm/codegen-arm.h b/deps/v8/src/arm/codegen-arm.h index 01aa8052e1..d27982abac 100644 --- a/deps/v8/src/arm/codegen-arm.h +++ b/deps/v8/src/arm/codegen-arm.h @@ -58,9 +58,7 @@ class CodeGenerator: public AstVisitor { // Print the code after compiling it. static void PrintCode(Handle code, CompilationInfo* info); -#ifdef ENABLE_LOGGING_AND_PROFILING static bool ShouldGenerateLog(Expression* type); -#endif static void SetFunctionInfo(Handle fun, FunctionLiteral* lit, diff --git a/deps/v8/src/arm/full-codegen-arm.cc b/deps/v8/src/arm/full-codegen-arm.cc index 4b55915e91..c3440eb3ea 100644 --- a/deps/v8/src/arm/full-codegen-arm.cc +++ b/deps/v8/src/arm/full-codegen-arm.cc @@ -776,7 +776,7 @@ void FullCodeGenerator::EmitDeclaration(Variable* variable, // IDs for bailouts from optimized code. ASSERT(prop->obj()->AsVariableProxy() != NULL); { AccumulatorValueContext for_object(this); - EmitVariableLoad(prop->obj()->AsVariableProxy()->var()); + EmitVariableLoad(prop->obj()->AsVariableProxy()); } __ push(r0); @@ -1113,7 +1113,7 @@ void FullCodeGenerator::EmitNewClosure(Handle info, void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) { Comment cmnt(masm_, "[ VariableProxy"); - EmitVariableLoad(expr->var()); + EmitVariableLoad(expr); } @@ -1262,7 +1262,11 @@ void FullCodeGenerator::EmitDynamicLoadFromSlotFastCase( } -void FullCodeGenerator::EmitVariableLoad(Variable* var) { +void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) { + // Record position before possible IC call. + SetSourcePosition(proxy->position()); + Variable* var = proxy->var(); + // Three cases: non-this global variables, lookup slots, and all other // types of slots. Slot* slot = var->AsSlot(); @@ -1593,7 +1597,7 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { { AccumulatorValueContext context(this); switch (assign_type) { case VARIABLE: - EmitVariableLoad(expr->target()->AsVariableProxy()->var()); + EmitVariableLoad(expr->target()->AsVariableProxy()); PrepareForBailout(expr->target(), TOS_REG); break; case NAMED_PROPERTY: @@ -2772,13 +2776,12 @@ void FullCodeGenerator::EmitLog(ZoneList* args) { // with '%2s' (see Logger::LogRuntime for all the formats). // 2 (array): Arguments to the format string. ASSERT_EQ(args->length(), 3); -#ifdef ENABLE_LOGGING_AND_PROFILING if (CodeGenerator::ShouldGenerateLog(args->at(0))) { VisitForStackValue(args->at(1)); VisitForStackValue(args->at(2)); __ CallRuntime(Runtime::kLog, 2); } -#endif + // Finally, we're expected to leave a value on the top of the stack. __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); context()->Plug(r0); @@ -3816,7 +3819,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { if (assign_type == VARIABLE) { ASSERT(expr->expression()->AsVariableProxy()->var() != NULL); AccumulatorValueContext context(this); - EmitVariableLoad(expr->expression()->AsVariableProxy()->var()); + EmitVariableLoad(expr->expression()->AsVariableProxy()); } else { // Reserve space for result of postfix operation. if (expr->is_postfix() && !context()->IsEffect()) { diff --git a/deps/v8/src/arm/ic-arm.cc b/deps/v8/src/arm/ic-arm.cc index dea875bad4..6038153a1a 100644 --- a/deps/v8/src/arm/ic-arm.cc +++ b/deps/v8/src/arm/ic-arm.cc @@ -212,101 +212,6 @@ static void GenerateDictionaryStore(MacroAssembler* masm, } -static void GenerateNumberDictionaryLoad(MacroAssembler* masm, - Label* miss, - Register elements, - Register key, - Register result, - Register t0, - Register t1, - Register t2) { - // Register use: - // - // elements - holds the slow-case elements of the receiver on entry. - // Unchanged unless 'result' is the same register. - // - // key - holds the smi key on entry. - // Unchanged unless 'result' is the same register. - // - // result - holds the result on exit if the load succeeded. - // Allowed to be the same as 'key' or 'result'. - // Unchanged on bailout so 'key' or 'result' can be used - // in further computation. - // - // Scratch registers: - // - // t0 - holds the untagged key on entry and holds the hash once computed. - // - // t1 - used to hold the capacity mask of the dictionary - // - // t2 - used for the index into the dictionary. - Label done; - - // Compute the hash code from the untagged key. This must be kept in sync - // with ComputeIntegerHash in utils.h. - // - // hash = ~hash + (hash << 15); - __ mvn(t1, Operand(t0)); - __ add(t0, t1, Operand(t0, LSL, 15)); - // hash = hash ^ (hash >> 12); - __ eor(t0, t0, Operand(t0, LSR, 12)); - // hash = hash + (hash << 2); - __ add(t0, t0, Operand(t0, LSL, 2)); - // hash = hash ^ (hash >> 4); - __ eor(t0, t0, Operand(t0, LSR, 4)); - // hash = hash * 2057; - __ mov(t1, Operand(2057)); - __ mul(t0, t0, t1); - // hash = hash ^ (hash >> 16); - __ eor(t0, t0, Operand(t0, LSR, 16)); - - // Compute the capacity mask. - __ ldr(t1, FieldMemOperand(elements, NumberDictionary::kCapacityOffset)); - __ mov(t1, Operand(t1, ASR, kSmiTagSize)); // convert smi to int - __ sub(t1, t1, Operand(1)); - - // Generate an unrolled loop that performs a few probes before giving up. - static const int kProbes = 4; - for (int i = 0; i < kProbes; i++) { - // Use t2 for index calculations and keep the hash intact in t0. - __ mov(t2, t0); - // Compute the masked index: (hash + i + i * i) & mask. - if (i > 0) { - __ add(t2, t2, Operand(NumberDictionary::GetProbeOffset(i))); - } - __ and_(t2, t2, Operand(t1)); - - // Scale the index by multiplying by the element size. - ASSERT(NumberDictionary::kEntrySize == 3); - __ add(t2, t2, Operand(t2, LSL, 1)); // t2 = t2 * 3 - - // Check if the key is identical to the name. - __ add(t2, elements, Operand(t2, LSL, kPointerSizeLog2)); - __ ldr(ip, FieldMemOperand(t2, NumberDictionary::kElementsStartOffset)); - __ cmp(key, Operand(ip)); - if (i != kProbes - 1) { - __ b(eq, &done); - } else { - __ b(ne, miss); - } - } - - __ bind(&done); - // Check that the value is a normal property. - // t2: elements + (index * kPointerSize) - const int kDetailsOffset = - NumberDictionary::kElementsStartOffset + 2 * kPointerSize; - __ ldr(t1, FieldMemOperand(t2, kDetailsOffset)); - __ tst(t1, Operand(Smi::FromInt(PropertyDetails::TypeField::mask()))); - __ b(ne, miss); - - // Get the value at the masked, scaled index and return. - const int kValueOffset = - NumberDictionary::kElementsStartOffset + kPointerSize; - __ ldr(result, FieldMemOperand(t2, kValueOffset)); -} - - void LoadIC::GenerateArrayLength(MacroAssembler* masm) { // ----------- S t a t e ------------- // -- r2 : name @@ -738,7 +643,7 @@ void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) { __ b(ne, &slow_load); __ mov(r0, Operand(r2, ASR, kSmiTagSize)); // r0: untagged index - GenerateNumberDictionaryLoad(masm, &slow_load, r4, r2, r1, r0, r3, r5); + __ LoadFromNumberDictionary(&slow_load, r4, r2, r1, r0, r3, r5); __ IncrementCounter(counters->keyed_call_generic_smi_dict(), 1, r0, r3); __ jmp(&do_call); @@ -1127,7 +1032,7 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { __ cmp(r3, ip); __ b(ne, &slow); __ mov(r2, Operand(r0, ASR, kSmiTagSize)); - GenerateNumberDictionaryLoad(masm, &slow, r4, r0, r0, r2, r3, r5); + __ LoadFromNumberDictionary(&slow, r4, r0, r0, r2, r3, r5); __ Ret(); // Slow case, key and receiver still in r0 and r1. diff --git a/deps/v8/src/arm/lithium-codegen-arm.cc b/deps/v8/src/arm/lithium-codegen-arm.cc index ee36314209..dc93aea346 100644 --- a/deps/v8/src/arm/lithium-codegen-arm.cc +++ b/deps/v8/src/arm/lithium-codegen-arm.cc @@ -551,6 +551,13 @@ void LCodeGen::CallCodeGeneric(Handle code, RecordPosition(pointers->position()); __ Call(code, mode); RegisterLazyDeoptimization(instr, safepoint_mode); + + // Signal that we don't inline smi code before these stubs in the + // optimizing code generator. + if (code->kind() == Code::BINARY_OP_IC || + code->kind() == Code::COMPARE_IC) { + __ nop(); + } } @@ -1506,6 +1513,7 @@ void LCodeGen::DoArithmeticT(LArithmeticT* instr) { BinaryOpStub stub(instr->op(), NO_OVERWRITE); CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); + __ nop(); // Signals no inlined code. } diff --git a/deps/v8/src/arm/macro-assembler-arm.cc b/deps/v8/src/arm/macro-assembler-arm.cc index 08a1cb9453..320879a627 100644 --- a/deps/v8/src/arm/macro-assembler-arm.cc +++ b/deps/v8/src/arm/macro-assembler-arm.cc @@ -1343,6 +1343,100 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, } +void MacroAssembler::LoadFromNumberDictionary(Label* miss, + Register elements, + Register key, + Register result, + Register t0, + Register t1, + Register t2) { + // Register use: + // + // elements - holds the slow-case elements of the receiver on entry. + // Unchanged unless 'result' is the same register. + // + // key - holds the smi key on entry. + // Unchanged unless 'result' is the same register. + // + // result - holds the result on exit if the load succeeded. + // Allowed to be the same as 'key' or 'result'. + // Unchanged on bailout so 'key' or 'result' can be used + // in further computation. + // + // Scratch registers: + // + // t0 - holds the untagged key on entry and holds the hash once computed. + // + // t1 - used to hold the capacity mask of the dictionary + // + // t2 - used for the index into the dictionary. + Label done; + + // Compute the hash code from the untagged key. This must be kept in sync + // with ComputeIntegerHash in utils.h. + // + // hash = ~hash + (hash << 15); + mvn(t1, Operand(t0)); + add(t0, t1, Operand(t0, LSL, 15)); + // hash = hash ^ (hash >> 12); + eor(t0, t0, Operand(t0, LSR, 12)); + // hash = hash + (hash << 2); + add(t0, t0, Operand(t0, LSL, 2)); + // hash = hash ^ (hash >> 4); + eor(t0, t0, Operand(t0, LSR, 4)); + // hash = hash * 2057; + mov(t1, Operand(2057)); + mul(t0, t0, t1); + // hash = hash ^ (hash >> 16); + eor(t0, t0, Operand(t0, LSR, 16)); + + // Compute the capacity mask. + ldr(t1, FieldMemOperand(elements, NumberDictionary::kCapacityOffset)); + mov(t1, Operand(t1, ASR, kSmiTagSize)); // convert smi to int + sub(t1, t1, Operand(1)); + + // Generate an unrolled loop that performs a few probes before giving up. + static const int kProbes = 4; + for (int i = 0; i < kProbes; i++) { + // Use t2 for index calculations and keep the hash intact in t0. + mov(t2, t0); + // Compute the masked index: (hash + i + i * i) & mask. + if (i > 0) { + add(t2, t2, Operand(NumberDictionary::GetProbeOffset(i))); + } + and_(t2, t2, Operand(t1)); + + // Scale the index by multiplying by the element size. + ASSERT(NumberDictionary::kEntrySize == 3); + add(t2, t2, Operand(t2, LSL, 1)); // t2 = t2 * 3 + + // Check if the key is identical to the name. + add(t2, elements, Operand(t2, LSL, kPointerSizeLog2)); + ldr(ip, FieldMemOperand(t2, NumberDictionary::kElementsStartOffset)); + cmp(key, Operand(ip)); + if (i != kProbes - 1) { + b(eq, &done); + } else { + b(ne, miss); + } + } + + bind(&done); + // Check that the value is a normal property. + // t2: elements + (index * kPointerSize) + const int kDetailsOffset = + NumberDictionary::kElementsStartOffset + 2 * kPointerSize; + ldr(t1, FieldMemOperand(t2, kDetailsOffset)); + tst(t1, Operand(Smi::FromInt(PropertyDetails::TypeField::mask()))); + b(ne, miss); + + // Get the value at the masked, scaled index and return. + const int kValueOffset = + NumberDictionary::kElementsStartOffset + kPointerSize; + ldr(result, FieldMemOperand(t2, kValueOffset)); +} + + void MacroAssembler::AllocateInNewSpace(int object_size, Register result, Register scratch1, diff --git a/deps/v8/src/arm/macro-assembler-arm.h b/deps/v8/src/arm/macro-assembler-arm.h index 1918858ebe..07281a7caf 100644 --- a/deps/v8/src/arm/macro-assembler-arm.h +++ b/deps/v8/src/arm/macro-assembler-arm.h @@ -433,6 +433,16 @@ class MacroAssembler: public Assembler { Register scratch, Label* miss); + + void LoadFromNumberDictionary(Label* miss, + Register elements, + Register key, + Register result, + Register t0, + Register t1, + Register t2); + + inline void MarkCode(NopMarkerTypes type) { nop(type); } diff --git a/deps/v8/src/arm/regexp-macro-assembler-arm.h b/deps/v8/src/arm/regexp-macro-assembler-arm.h index d771e4033f..0e653868b6 100644 --- a/deps/v8/src/arm/regexp-macro-assembler-arm.h +++ b/deps/v8/src/arm/regexp-macro-assembler-arm.h @@ -28,6 +28,9 @@ #ifndef V8_ARM_REGEXP_MACRO_ASSEMBLER_ARM_H_ #define V8_ARM_REGEXP_MACRO_ASSEMBLER_ARM_H_ +#include "arm/assembler-arm.h" +#include "arm/assembler-arm-inl.h" + namespace v8 { namespace internal { diff --git a/deps/v8/src/arm/stub-cache-arm.cc b/deps/v8/src/arm/stub-cache-arm.cc index caa6a0eef9..86e49716d3 100644 --- a/deps/v8/src/arm/stub-cache-arm.cc +++ b/deps/v8/src/arm/stub-cache-arm.cc @@ -3100,7 +3100,8 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadElement(Map* receiver_map) { // -- r1 : receiver // ----------------------------------- Code* stub; - MaybeObject* maybe_stub = ComputeSharedKeyedLoadElementStub(receiver_map); + JSObject::ElementsKind elements_kind = receiver_map->elements_kind(); + MaybeObject* maybe_stub = KeyedLoadElementStub(elements_kind).TryGetCode(); if (!maybe_stub->To(&stub)) return maybe_stub; __ DispatchMap(r1, r2, @@ -3193,7 +3194,10 @@ MaybeObject* KeyedStoreStubCompiler::CompileStoreElement(Map* receiver_map) { // -- r3 : scratch // ----------------------------------- Code* stub; - MaybeObject* maybe_stub = ComputeSharedKeyedStoreElementStub(receiver_map); + JSObject::ElementsKind elements_kind = receiver_map->elements_kind(); + bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; + MaybeObject* maybe_stub = + KeyedStoreElementStub(is_js_array, elements_kind).TryGetCode(); if (!maybe_stub->To(&stub)) return maybe_stub; __ DispatchMap(r2, r3, @@ -3388,6 +3392,53 @@ MaybeObject* ConstructStubCompiler::CompileConstructStub(JSFunction* function) { #define __ ACCESS_MASM(masm) +void KeyedLoadStubCompiler::GenerateLoadDictionaryElement( + MacroAssembler* masm) { + // ---------- S t a t e -------------- + // -- lr : return address + // -- r0 : key + // -- r1 : receiver + // ----------------------------------- + Label slow, miss_force_generic; + + Register key = r0; + Register receiver = r1; + + __ JumpIfNotSmi(key, &miss_force_generic); + __ mov(r2, Operand(key, ASR, kSmiTagSize)); + __ ldr(r4, FieldMemOperand(receiver, JSObject::kElementsOffset)); + __ LoadFromNumberDictionary(&slow, r4, key, r0, r2, r3, r5); + __ Ret(); + + __ bind(&slow); + __ IncrementCounter( + masm->isolate()->counters()->keyed_load_external_array_slow(), + 1, r2, r3); + + // ---------- S t a t e -------------- + // -- lr : return address + // -- r0 : key + // -- r1 : receiver + // ----------------------------------- + Handle slow_ic = + masm->isolate()->builtins()->KeyedLoadIC_Slow(); + __ Jump(slow_ic, RelocInfo::CODE_TARGET); + + // Miss case, call the runtime. + __ bind(&miss_force_generic); + + // ---------- S t a t e -------------- + // -- lr : return address + // -- r0 : key + // -- r1 : receiver + // ----------------------------------- + + Handle miss_ic = + masm->isolate()->builtins()->KeyedLoadIC_MissForceGeneric(); + __ Jump(miss_ic, RelocInfo::CODE_TARGET); +} + + static bool IsElementTypeSigned(JSObject::ElementsKind elements_kind) { switch (elements_kind) { case JSObject::EXTERNAL_BYTE_ELEMENTS: diff --git a/deps/v8/src/code-stubs.cc b/deps/v8/src/code-stubs.cc index db57280f41..5c0ef5a4a5 100644 --- a/deps/v8/src/code-stubs.cc +++ b/deps/v8/src/code-stubs.cc @@ -61,21 +61,29 @@ void CodeStub::GenerateCode(MacroAssembler* masm) { } +SmartPointer CodeStub::GetName() { + char buffer[100]; + NoAllocationStringAllocator allocator(buffer, + static_cast(sizeof(buffer))); + StringStream stream(&allocator); + PrintName(&stream); + return stream.ToCString(); +} + + void CodeStub::RecordCodeGeneration(Code* code, MacroAssembler* masm) { code->set_major_key(MajorKey()); Isolate* isolate = masm->isolate(); - PROFILE(isolate, CodeCreateEvent(Logger::STUB_TAG, code, GetName())); - GDBJIT(AddCode(GDBJITInterface::STUB, GetName(), code)); + SmartPointer name = GetName(); + PROFILE(isolate, CodeCreateEvent(Logger::STUB_TAG, code, *name)); + GDBJIT(AddCode(GDBJITInterface::STUB, *name, code)); Counters* counters = isolate->counters(); counters->total_stubs_code_size()->Increment(code->instruction_size()); #ifdef ENABLE_DISASSEMBLER if (FLAG_print_code_stubs) { -#ifdef DEBUG - Print(); -#endif - code->Disassemble(GetName()); + code->Disassemble(*name); PrintF("\n"); } #endif @@ -170,7 +178,7 @@ MaybeObject* CodeStub::TryGetCode() { const char* CodeStub::MajorName(CodeStub::Major major_key, bool allow_unknown_keys) { switch (major_key) { -#define DEF_CASE(name) case name: return #name; +#define DEF_CASE(name) case name: return #name "Stub"; CODE_STUB_LIST(DEF_CASE) #undef DEF_CASE default: @@ -213,13 +221,7 @@ void ICCompareStub::Generate(MacroAssembler* masm) { } -const char* InstanceofStub::GetName() { - if (name_ != NULL) return name_; - const int kMaxNameLength = 100; - name_ = Isolate::Current()->bootstrapper()->AllocateAutoDeletedArray( - kMaxNameLength); - if (name_ == NULL) return "OOM"; - +void InstanceofStub::PrintName(StringStream* stream) { const char* args = ""; if (HasArgsInRegisters()) { args = "_REGS"; @@ -235,33 +237,95 @@ const char* InstanceofStub::GetName() { return_true_false_object = "_TRUEFALSE"; } - OS::SNPrintF(Vector(name_, kMaxNameLength), - "InstanceofStub%s%s%s", - args, - inline_check, - return_true_false_object); - return name_; + stream->Add("InstanceofStub%s%s%s", + args, + inline_check, + return_true_false_object); } -void KeyedLoadFastElementStub::Generate(MacroAssembler* masm) { - KeyedLoadStubCompiler::GenerateLoadFastElement(masm); +void KeyedLoadElementStub::Generate(MacroAssembler* masm) { + switch (elements_kind_) { + case JSObject::FAST_ELEMENTS: + KeyedLoadStubCompiler::GenerateLoadFastElement(masm); + break; + case JSObject::FAST_DOUBLE_ELEMENTS: + UNIMPLEMENTED(); + break; + case JSObject::EXTERNAL_BYTE_ELEMENTS: + case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS: + case JSObject::EXTERNAL_SHORT_ELEMENTS: + case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS: + case JSObject::EXTERNAL_INT_ELEMENTS: + case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS: + case JSObject::EXTERNAL_FLOAT_ELEMENTS: + case JSObject::EXTERNAL_DOUBLE_ELEMENTS: + case JSObject::EXTERNAL_PIXEL_ELEMENTS: + KeyedLoadStubCompiler::GenerateLoadExternalArray(masm, elements_kind_); + break; + case JSObject::DICTIONARY_ELEMENTS: + KeyedLoadStubCompiler::GenerateLoadDictionaryElement(masm); + break; + case JSObject::NON_STRICT_ARGUMENTS_ELEMENTS: + UNREACHABLE(); + break; + } } -void KeyedStoreFastElementStub::Generate(MacroAssembler* masm) { - KeyedStoreStubCompiler::GenerateStoreFastElement(masm, is_js_array_); +void KeyedStoreElementStub::Generate(MacroAssembler* masm) { + switch (elements_kind_) { + case JSObject::FAST_ELEMENTS: + KeyedStoreStubCompiler::GenerateStoreFastElement(masm, is_js_array_); + break; + case JSObject::FAST_DOUBLE_ELEMENTS: + UNIMPLEMENTED(); + break; + case JSObject::EXTERNAL_BYTE_ELEMENTS: + case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS: + case JSObject::EXTERNAL_SHORT_ELEMENTS: + case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS: + case JSObject::EXTERNAL_INT_ELEMENTS: + case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS: + case JSObject::EXTERNAL_FLOAT_ELEMENTS: + case JSObject::EXTERNAL_DOUBLE_ELEMENTS: + case JSObject::EXTERNAL_PIXEL_ELEMENTS: + KeyedStoreStubCompiler::GenerateStoreExternalArray(masm, elements_kind_); + break; + case JSObject::DICTIONARY_ELEMENTS: + KeyedStoreStubCompiler::GenerateStoreDictionaryElement(masm); + break; + case JSObject::NON_STRICT_ARGUMENTS_ELEMENTS: + UNREACHABLE(); + break; + } } -void KeyedLoadExternalArrayStub::Generate(MacroAssembler* masm) { - KeyedLoadStubCompiler::GenerateLoadExternalArray(masm, elements_kind_); +void ArgumentsAccessStub::PrintName(StringStream* stream) { + const char* type_name = NULL; // Make g++ happy. + switch (type_) { + case READ_ELEMENT: type_name = "ReadElement"; break; + case NEW_NON_STRICT_FAST: type_name = "NewNonStrictFast"; break; + case NEW_NON_STRICT_SLOW: type_name = "NewNonStrictSlow"; break; + case NEW_STRICT: type_name = "NewStrict"; break; + } + stream->Add("ArgumentsAccessStub_%s", type_name); } -void KeyedStoreExternalArrayStub::Generate(MacroAssembler* masm) { - KeyedStoreStubCompiler::GenerateStoreExternalArray(masm, elements_kind_); +void CallFunctionStub::PrintName(StringStream* stream) { + const char* in_loop_name = NULL; // Make g++ happy. + switch (in_loop_) { + case NOT_IN_LOOP: in_loop_name = ""; break; + case IN_LOOP: in_loop_name = "_InLoop"; break; + } + const char* flags_name = NULL; // Make g++ happy. + switch (flags_) { + case NO_CALL_FUNCTION_FLAGS: flags_name = ""; break; + case RECEIVER_MIGHT_BE_IMPLICIT: flags_name = "_Implicit"; break; + } + stream->Add("CallFunctionStub_Args%d%s%s", argc_, in_loop_name, flags_name); } - } } // namespace v8::internal diff --git a/deps/v8/src/code-stubs.h b/deps/v8/src/code-stubs.h index 3a756585e5..17c245c80e 100644 --- a/deps/v8/src/code-stubs.h +++ b/deps/v8/src/code-stubs.h @@ -70,10 +70,8 @@ namespace internal { V(NumberToString) \ V(CEntry) \ V(JSEntry) \ - V(KeyedLoadFastElement) \ - V(KeyedStoreFastElement) \ - V(KeyedLoadExternalArray) \ - V(KeyedStoreExternalArray) \ + V(KeyedLoadElement) \ + V(KeyedStoreElement) \ V(DebuggerStatement) \ V(StringDictionaryNegativeLookup) @@ -183,16 +181,15 @@ class CodeStub BASE_EMBEDDED { } // Returns a name for logging/debugging purposes. - virtual const char* GetName() { return MajorName(MajorKey(), false); } + SmartPointer GetName(); + virtual void PrintName(StringStream* stream) { + stream->Add("%s", MajorName(MajorKey(), false)); + } // Returns whether the code generated for this stub needs to be allocated as // a fixed (non-moveable) code object. virtual bool NeedsImmovableCode() { return false; } - #ifdef DEBUG - virtual void Print() { PrintF("%s\n", GetName()); } -#endif - // Computes the key based on major and minor. uint32_t GetKey() { ASSERT(static_cast(MajorKey()) < NUMBER_OF_IDS); @@ -274,8 +271,6 @@ class StackCheckStub : public CodeStub { void Generate(MacroAssembler* masm); private: - const char* GetName() { return "StackCheckStub"; } - Major MajorKey() { return StackCheck; } int MinorKey() { return 0; } }; @@ -290,7 +285,6 @@ class ToNumberStub: public CodeStub { private: Major MajorKey() { return ToNumber; } int MinorKey() { return 0; } - const char* GetName() { return "ToNumberStub"; } }; @@ -302,7 +296,6 @@ class FastNewClosureStub : public CodeStub { void Generate(MacroAssembler* masm); private: - const char* GetName() { return "FastNewClosureStub"; } Major MajorKey() { return FastNewClosure; } int MinorKey() { return strict_mode_; } @@ -323,7 +316,6 @@ class FastNewContextStub : public CodeStub { private: int slots_; - const char* GetName() { return "FastNewContextStub"; } Major MajorKey() { return FastNewContext; } int MinorKey() { return slots_; } }; @@ -352,7 +344,6 @@ class FastCloneShallowArrayStub : public CodeStub { Mode mode_; int length_; - const char* GetName() { return "FastCloneShallowArrayStub"; } Major MajorKey() { return FastCloneShallowArray; } int MinorKey() { ASSERT(mode_ == 0 || mode_ == 1); @@ -370,7 +361,7 @@ class InstanceofStub: public CodeStub { kReturnTrueFalseObject = 1 << 2 }; - explicit InstanceofStub(Flags flags) : flags_(flags), name_(NULL) { } + explicit InstanceofStub(Flags flags) : flags_(flags) { } static Register left(); static Register right(); @@ -393,10 +384,9 @@ class InstanceofStub: public CodeStub { return (flags_ & kReturnTrueFalseObject) != 0; } - const char* GetName(); + virtual void PrintName(StringStream* stream); Flags flags_; - char* name_; }; @@ -408,8 +398,6 @@ class MathPowStub: public CodeStub { private: virtual CodeStub::Major MajorKey() { return MathPow; } virtual int MinorKey() { return 0; } - - const char* GetName() { return "MathPowStub"; } }; @@ -476,8 +464,7 @@ class CompareStub: public CodeStub { include_number_compare_((flags & NO_NUMBER_COMPARE_IN_STUB) == 0), include_smi_compare_((flags & NO_SMI_COMPARE_IN_STUB) == 0), lhs_(lhs), - rhs_(rhs), - name_(NULL) { } + rhs_(rhs) { } CompareStub(Condition cc, bool strict, @@ -488,8 +475,7 @@ class CompareStub: public CodeStub { include_number_compare_((flags & NO_NUMBER_COMPARE_IN_STUB) == 0), include_smi_compare_((flags & NO_SMI_COMPARE_IN_STUB) == 0), lhs_(no_reg), - rhs_(no_reg), - name_(NULL) { } + rhs_(no_reg) { } void Generate(MacroAssembler* masm); @@ -543,26 +529,7 @@ class CompareStub: public CodeStub { // Unfortunately you have to run without snapshots to see most of these // names in the profile since most compare stubs end up in the snapshot. - char* name_; - const char* GetName(); -#ifdef DEBUG - void Print() { - PrintF("CompareStub (minor %d) (cc %d), (strict %s), " - "(never_nan_nan %s), (smi_compare %s) (number_compare %s) ", - MinorKey(), - static_cast(cc_), - strict_ ? "true" : "false", - never_nan_nan_ ? "true" : "false", - include_smi_compare_ ? "inluded" : "not included", - include_number_compare_ ? "included" : "not included"); - - if (!lhs_.is(no_reg) && !rhs_.is(no_reg)) { - PrintF("(lhs r%d), (rhs r%d)\n", lhs_.code(), rhs_.code()); - } else { - PrintF("\n"); - } - } -#endif + virtual void PrintName(StringStream* stream); }; @@ -593,8 +560,6 @@ class CEntryStub : public CodeStub { int MinorKey(); bool NeedsImmovableCode(); - - const char* GetName() { return "CEntryStub"; } }; @@ -610,8 +575,6 @@ class JSEntryStub : public CodeStub { private: Major MajorKey() { return JSEntry; } int MinorKey() { return 0; } - - const char* GetName() { return "JSEntryStub"; } }; @@ -624,7 +587,9 @@ class JSConstructEntryStub : public JSEntryStub { private: int MinorKey() { return 1; } - const char* GetName() { return "JSConstructEntryStub"; } + virtual void PrintName(StringStream* stream) { + stream->Add("JSConstructEntryStub"); + } }; @@ -651,13 +616,7 @@ class ArgumentsAccessStub: public CodeStub { void GenerateNewNonStrictFast(MacroAssembler* masm); void GenerateNewNonStrictSlow(MacroAssembler* masm); - const char* GetName() { return "ArgumentsAccessStub"; } - -#ifdef DEBUG - void Print() { - PrintF("ArgumentsAccessStub (type %d)\n", type_); - } -#endif + virtual void PrintName(StringStream* stream); }; @@ -670,14 +629,6 @@ class RegExpExecStub: public CodeStub { int MinorKey() { return 0; } void Generate(MacroAssembler* masm); - - const char* GetName() { return "RegExpExecStub"; } - -#ifdef DEBUG - void Print() { - PrintF("RegExpExecStub\n"); - } -#endif }; @@ -690,14 +641,6 @@ class RegExpConstructResultStub: public CodeStub { int MinorKey() { return 0; } void Generate(MacroAssembler* masm); - - const char* GetName() { return "RegExpConstructResultStub"; } - -#ifdef DEBUG - void Print() { - PrintF("RegExpConstructResultStub\n"); - } -#endif }; @@ -717,14 +660,7 @@ class CallFunctionStub: public CodeStub { InLoopFlag in_loop_; CallFunctionFlags flags_; -#ifdef DEBUG - void Print() { - PrintF("CallFunctionStub (args %d, in_loop %d, flags %d)\n", - argc_, - static_cast(in_loop_), - static_cast(flags_)); - } -#endif + virtual void PrintName(StringStream* stream); // Minor key encoding in 32 bits with Bitfield . class InLoopBits: public BitField {}; @@ -921,83 +857,44 @@ class AllowStubCallsScope { DISALLOW_COPY_AND_ASSIGN(AllowStubCallsScope); }; -#ifdef DEBUG -#define DECLARE_ARRAY_STUB_PRINT(name) void Print() { PrintF(#name); } -#else -#define DECLARE_ARRAY_STUB_PRINT(name) -#endif - -class KeyedLoadFastElementStub : public CodeStub { +class KeyedLoadElementStub : public CodeStub { public: - explicit KeyedLoadFastElementStub() { - } + explicit KeyedLoadElementStub(JSObject::ElementsKind elements_kind) + : elements_kind_(elements_kind) + { } - Major MajorKey() { return KeyedLoadFastElement; } - int MinorKey() { return 0; } + Major MajorKey() { return KeyedLoadElement; } + int MinorKey() { return elements_kind_; } void Generate(MacroAssembler* masm); - const char* GetName() { return "KeyedLoadFastElementStub"; } + private: + JSObject::ElementsKind elements_kind_; - DECLARE_ARRAY_STUB_PRINT(KeyedLoadFastElementStub) + DISALLOW_COPY_AND_ASSIGN(KeyedLoadElementStub); }; -class KeyedStoreFastElementStub : public CodeStub { +class KeyedStoreElementStub : public CodeStub { public: - explicit KeyedStoreFastElementStub(bool is_js_array) - : is_js_array_(is_js_array) { } + KeyedStoreElementStub(bool is_js_array, + JSObject::ElementsKind elements_kind) + : is_js_array_(is_js_array), + elements_kind_(elements_kind) { } - Major MajorKey() { return KeyedStoreFastElement; } - int MinorKey() { return is_js_array_ ? 1 : 0; } + Major MajorKey() { return KeyedStoreElement; } + int MinorKey() { + return (is_js_array_ ? 0 : JSObject::kElementsKindCount) + elements_kind_; + } void Generate(MacroAssembler* masm); - const char* GetName() { return "KeyedStoreFastElementStub"; } - - DECLARE_ARRAY_STUB_PRINT(KeyedStoreFastElementStub) - private: bool is_js_array_; -}; - - -class KeyedLoadExternalArrayStub : public CodeStub { - public: - explicit KeyedLoadExternalArrayStub(JSObject::ElementsKind elements_kind) - : elements_kind_(elements_kind) { } - - Major MajorKey() { return KeyedLoadExternalArray; } - int MinorKey() { return elements_kind_; } - - void Generate(MacroAssembler* masm); - - const char* GetName() { return "KeyedLoadExternalArrayStub"; } - - DECLARE_ARRAY_STUB_PRINT(KeyedLoadExternalArrayStub) - - protected: JSObject::ElementsKind elements_kind_; -}; - - -class KeyedStoreExternalArrayStub : public CodeStub { - public: - explicit KeyedStoreExternalArrayStub(JSObject::ElementsKind elements_kind) - : elements_kind_(elements_kind) { } - - Major MajorKey() { return KeyedStoreExternalArray; } - int MinorKey() { return elements_kind_; } - - void Generate(MacroAssembler* masm); - - const char* GetName() { return "KeyedStoreExternalArrayStub"; } - DECLARE_ARRAY_STUB_PRINT(KeyedStoreExternalArrayStub) - - protected: - JSObject::ElementsKind elements_kind_; + DISALLOW_COPY_AND_ASSIGN(KeyedStoreElementStub); }; diff --git a/deps/v8/src/codegen.cc b/deps/v8/src/codegen.cc index 4e5c781361..fb723a3bcc 100644 --- a/deps/v8/src/codegen.cc +++ b/deps/v8/src/codegen.cc @@ -169,8 +169,6 @@ void CodeGenerator::PrintCode(Handle code, CompilationInfo* info) { #endif // ENABLE_DISASSEMBLER } -#ifdef ENABLE_LOGGING_AND_PROFILING - static Vector kRegexp = CStrVector("regexp"); bool CodeGenerator::ShouldGenerateLog(Expression* type) { @@ -187,8 +185,6 @@ bool CodeGenerator::ShouldGenerateLog(Expression* type) { return false; } -#endif - bool CodeGenerator::RecordPositions(MacroAssembler* masm, int pos, diff --git a/deps/v8/src/conversions-inl.h b/deps/v8/src/conversions-inl.h index bb24a9c2b7..f1f526ffc0 100644 --- a/deps/v8/src/conversions-inl.h +++ b/deps/v8/src/conversions-inl.h @@ -43,6 +43,11 @@ namespace v8 { namespace internal { +static inline double JunkStringValue() { + return std::numeric_limits::quiet_NaN(); +} + + // The fast double-to-unsigned-int conversion routine does not guarantee // rounding towards zero, or any reasonable value if the argument is larger // than what fits in an unsigned 32-bit integer. @@ -151,7 +156,7 @@ static double InternalStringToIntDouble(UnicodeCache* unicode_cache, !AdvanceToNonspace(unicode_cache, ¤t, end)) { break; } else { - return JUNK_STRING_VALUE; + return JunkStringValue(); } } @@ -181,7 +186,7 @@ static double InternalStringToIntDouble(UnicodeCache* unicode_cache, if (!allow_trailing_junk && AdvanceToNonspace(unicode_cache, ¤t, end)) { - return JUNK_STRING_VALUE; + return JunkStringValue(); } int middle_value = (1 << (overflow_bits_count - 1)); @@ -229,7 +234,7 @@ static double InternalStringToInt(UnicodeCache* unicode_cache, EndMark end, int radix) { const bool allow_trailing_junk = true; - const double empty_string_val = JUNK_STRING_VALUE; + const double empty_string_val = JunkStringValue(); if (!AdvanceToNonspace(unicode_cache, ¤t, end)) { return empty_string_val; @@ -242,12 +247,12 @@ static double InternalStringToInt(UnicodeCache* unicode_cache, // Ignore leading sign; skip following spaces. ++current; if (current == end) { - return JUNK_STRING_VALUE; + return JunkStringValue(); } } else if (*current == '-') { ++current; if (current == end) { - return JUNK_STRING_VALUE; + return JunkStringValue(); } negative = true; } @@ -260,7 +265,7 @@ static double InternalStringToInt(UnicodeCache* unicode_cache, if (*current == 'x' || *current == 'X') { radix = 16; ++current; - if (current == end) return JUNK_STRING_VALUE; + if (current == end) return JunkStringValue(); } else { radix = 8; leading_zero = true; @@ -275,14 +280,14 @@ static double InternalStringToInt(UnicodeCache* unicode_cache, if (current == end) return SignedZero(negative); if (*current == 'x' || *current == 'X') { ++current; - if (current == end) return JUNK_STRING_VALUE; + if (current == end) return JunkStringValue(); } else { leading_zero = true; } } } - if (radix < 2 || radix > 36) return JUNK_STRING_VALUE; + if (radix < 2 || radix > 36) return JunkStringValue(); // Skip leading zeros. while (*current == '0') { @@ -292,7 +297,7 @@ static double InternalStringToInt(UnicodeCache* unicode_cache, } if (!leading_zero && !isDigit(*current, radix)) { - return JUNK_STRING_VALUE; + return JunkStringValue(); } if (IsPowerOf2(radix)) { @@ -340,7 +345,7 @@ static double InternalStringToInt(UnicodeCache* unicode_cache, if (!allow_trailing_junk && AdvanceToNonspace(unicode_cache, ¤t, end)) { - return JUNK_STRING_VALUE; + return JunkStringValue(); } ASSERT(buffer_pos < kBufferSize); @@ -406,7 +411,7 @@ static double InternalStringToInt(UnicodeCache* unicode_cache, if (!allow_trailing_junk && AdvanceToNonspace(unicode_cache, ¤t, end)) { - return JUNK_STRING_VALUE; + return JunkStringValue(); } return negative ? -v : v; @@ -456,22 +461,22 @@ static double InternalStringToDouble(UnicodeCache* unicode_cache, if (*current == '+') { // Ignore leading sign. ++current; - if (current == end) return JUNK_STRING_VALUE; + if (current == end) return JunkStringValue(); } else if (*current == '-') { ++current; - if (current == end) return JUNK_STRING_VALUE; + if (current == end) return JunkStringValue(); negative = true; } static const char kInfinitySymbol[] = "Infinity"; if (*current == kInfinitySymbol[0]) { if (!SubStringEquals(¤t, end, kInfinitySymbol)) { - return JUNK_STRING_VALUE; + return JunkStringValue(); } if (!allow_trailing_junk && AdvanceToNonspace(unicode_cache, ¤t, end)) { - return JUNK_STRING_VALUE; + return JunkStringValue(); } ASSERT(buffer_pos == 0); @@ -489,7 +494,7 @@ static double InternalStringToDouble(UnicodeCache* unicode_cache, if ((flags & ALLOW_HEX) && (*current == 'x' || *current == 'X')) { ++current; if (current == end || !isDigit(*current, 16)) { - return JUNK_STRING_VALUE; // "0x". + return JunkStringValue(); // "0x". } return InternalStringToIntDouble<4>(unicode_cache, @@ -529,13 +534,13 @@ static double InternalStringToDouble(UnicodeCache* unicode_cache, } if (*current == '.') { - if (octal && !allow_trailing_junk) return JUNK_STRING_VALUE; + if (octal && !allow_trailing_junk) return JunkStringValue(); if (octal) goto parsing_done; ++current; if (current == end) { if (significant_digits == 0 && !leading_zero) { - return JUNK_STRING_VALUE; + return JunkStringValue(); } else { goto parsing_done; } @@ -576,18 +581,18 @@ static double InternalStringToDouble(UnicodeCache* unicode_cache, // If exponent < 0 then string was [+-]\.0*... // If significant_digits != 0 the string is not equal to 0. // Otherwise there are no digits in the string. - return JUNK_STRING_VALUE; + return JunkStringValue(); } // Parse exponential part. if (*current == 'e' || *current == 'E') { - if (octal) return JUNK_STRING_VALUE; + if (octal) return JunkStringValue(); ++current; if (current == end) { if (allow_trailing_junk) { goto parsing_done; } else { - return JUNK_STRING_VALUE; + return JunkStringValue(); } } char sign = '+'; @@ -598,7 +603,7 @@ static double InternalStringToDouble(UnicodeCache* unicode_cache, if (allow_trailing_junk) { goto parsing_done; } else { - return JUNK_STRING_VALUE; + return JunkStringValue(); } } } @@ -607,7 +612,7 @@ static double InternalStringToDouble(UnicodeCache* unicode_cache, if (allow_trailing_junk) { goto parsing_done; } else { - return JUNK_STRING_VALUE; + return JunkStringValue(); } } @@ -631,7 +636,7 @@ static double InternalStringToDouble(UnicodeCache* unicode_cache, if (!allow_trailing_junk && AdvanceToNonspace(unicode_cache, ¤t, end)) { - return JUNK_STRING_VALUE; + return JunkStringValue(); } parsing_done: diff --git a/deps/v8/src/conversions.cc b/deps/v8/src/conversions.cc index 232eda08c9..c34fe519c4 100644 --- a/deps/v8/src/conversions.cc +++ b/deps/v8/src/conversions.cc @@ -430,24 +430,4 @@ char* DoubleToRadixCString(double value, int radix) { return builder.Finalize(); } - -static Mutex* dtoa_lock_one = OS::CreateMutex(); -static Mutex* dtoa_lock_zero = OS::CreateMutex(); - - } } // namespace v8::internal - - -extern "C" { -void ACQUIRE_DTOA_LOCK(int n) { - ASSERT(n == 0 || n == 1); - (n == 0 ? v8::internal::dtoa_lock_zero : v8::internal::dtoa_lock_one)->Lock(); -} - - -void FREE_DTOA_LOCK(int n) { - ASSERT(n == 0 || n == 1); - (n == 0 ? v8::internal::dtoa_lock_zero : v8::internal::dtoa_lock_one)-> - Unlock(); -} -} diff --git a/deps/v8/src/conversions.h b/deps/v8/src/conversions.h index c3e27b2025..7b02c47f6a 100644 --- a/deps/v8/src/conversions.h +++ b/deps/v8/src/conversions.h @@ -44,8 +44,6 @@ namespace internal { // we don't need to preserve all the digits. const int kMaxSignificantDigits = 772; -static const double JUNK_STRING_VALUE = - std::numeric_limits::quiet_NaN(); static bool isDigit(int x, int radix) { return (x >= '0' && x <= '9' && x < '0' + radix) diff --git a/deps/v8/src/cpu-profiler-inl.h b/deps/v8/src/cpu-profiler-inl.h index d7a23a518a..938b632214 100644 --- a/deps/v8/src/cpu-profiler-inl.h +++ b/deps/v8/src/cpu-profiler-inl.h @@ -30,8 +30,6 @@ #include "cpu-profiler.h" -#ifdef ENABLE_LOGGING_AND_PROFILING - #include #include "circular-queue-inl.h" #include "profile-generator-inl.h" @@ -83,6 +81,4 @@ bool ProfilerEventsProcessor::FilterOutCodeCreateEvent( } } // namespace v8::internal -#endif // ENABLE_LOGGING_AND_PROFILING - #endif // V8_CPU_PROFILER_INL_H_ diff --git a/deps/v8/src/cpu-profiler.cc b/deps/v8/src/cpu-profiler.cc index 8b10e8188c..bb480fc345 100644 --- a/deps/v8/src/cpu-profiler.cc +++ b/deps/v8/src/cpu-profiler.cc @@ -29,8 +29,6 @@ #include "cpu-profiler-inl.h" -#ifdef ENABLE_LOGGING_AND_PROFILING - #include "frames-inl.h" #include "hashmap.h" #include "log-inl.h" @@ -574,31 +572,21 @@ void CpuProfiler::StopProcessor() { logger->logging_nesting_ = saved_logging_nesting_; } -} } // namespace v8::internal - -#endif // ENABLE_LOGGING_AND_PROFILING - -namespace v8 { -namespace internal { void CpuProfiler::Setup() { -#ifdef ENABLE_LOGGING_AND_PROFILING Isolate* isolate = Isolate::Current(); if (isolate->cpu_profiler() == NULL) { isolate->set_cpu_profiler(new CpuProfiler()); } -#endif } void CpuProfiler::TearDown() { -#ifdef ENABLE_LOGGING_AND_PROFILING Isolate* isolate = Isolate::Current(); if (isolate->cpu_profiler() != NULL) { delete isolate->cpu_profiler(); } isolate->set_cpu_profiler(NULL); -#endif } } } // namespace v8::internal diff --git a/deps/v8/src/cpu-profiler.h b/deps/v8/src/cpu-profiler.h index 42d79a578e..4175e8f680 100644 --- a/deps/v8/src/cpu-profiler.h +++ b/deps/v8/src/cpu-profiler.h @@ -28,8 +28,6 @@ #ifndef V8_CPU_PROFILER_H_ #define V8_CPU_PROFILER_H_ -#ifdef ENABLE_LOGGING_AND_PROFILING - #include "allocation.h" #include "atomicops.h" #include "circular-queue.h" @@ -206,9 +204,6 @@ class ProfilerEventsProcessor : public Thread { v8::internal::CpuProfiler::Call; \ } \ } while (false) -#else -#define PROFILE(isolate, Call) LOG(isolate, Call) -#endif // ENABLE_LOGGING_AND_PROFILING namespace v8 { @@ -221,7 +216,6 @@ class CpuProfiler { static void Setup(); static void TearDown(); -#ifdef ENABLE_LOGGING_AND_PROFILING static void StartProfiling(const char* title); static void StartProfiling(String* title); static CpuProfile* StopProfiling(const char* title); @@ -289,10 +283,6 @@ class CpuProfiler { bool need_to_stop_sampler_; Atomic32 is_profiling_; -#else - static INLINE(bool is_profiling(Isolate* isolate)) { return false; } -#endif // ENABLE_LOGGING_AND_PROFILING - private: DISALLOW_COPY_AND_ASSIGN(CpuProfiler); }; diff --git a/deps/v8/src/d8.cc b/deps/v8/src/d8.cc index 6f948c6e5c..5f57350093 100644 --- a/deps/v8/src/d8.cc +++ b/deps/v8/src/d8.cc @@ -41,6 +41,9 @@ #include "natives.h" #include "platform.h" +#if !defined(_WIN32) && !defined(_WIN64) +#include // NOLINT +#endif namespace v8 { @@ -97,6 +100,8 @@ CounterCollection Shell::local_counters_; CounterCollection* Shell::counters_ = &local_counters_; Persistent Shell::utility_context_; Persistent Shell::evaluation_context_; +i::Mutex* Shell::context_mutex_(i::OS::CreateMutex()); +ShellOptions Shell::options; bool CounterMap::Match(void* key1, void* key2) { @@ -119,6 +124,7 @@ bool Shell::ExecuteString(Handle source, bool report_exceptions) { HandleScope handle_scope; TryCatch try_catch; + options.script_executed = true; if (i::FLAG_debugger) { // When debugging make exceptions appear to be uncaught. try_catch.SetVerbose(true); @@ -238,7 +244,7 @@ Handle Shell::CreateExternalArray(const Arguments& args, if (raw_length < 0) { return ThrowException(String::New("Array length must not be negative.")); } - if (raw_length > v8::internal::ExternalArray::kMaxLength) { + if (raw_length > i::ExternalArray::kMaxLength) { return ThrowException( String::New("Array length exceeds maximum length.")); } @@ -246,7 +252,7 @@ Handle Shell::CreateExternalArray(const Arguments& args, } else { return ThrowException(String::New("Array length must be a number.")); } - if (length > static_cast(internal::ExternalArray::kMaxLength)) { + if (length > static_cast(i::ExternalArray::kMaxLength)) { return ThrowException(String::New("Array length exceeds maximum length.")); } void* data = calloc(length, element_size); @@ -540,7 +546,6 @@ void Shell::InstallUtilityScript() { shell_source_name.length()); Handle