Revision: 5709
Author: [email protected]
Date: Tue Oct 26 06:47:55 2010
Log: [Isolates] Convert more static data either to read-only or to
per-isolate.
Review URL: http://codereview.chromium.org/4070003
http://code.google.com/p/v8/source/detail?r=5709
Modified:
/branches/experimental/isolates/src/ast.h
/branches/experimental/isolates/src/codegen.cc
/branches/experimental/isolates/src/compiler.cc
/branches/experimental/isolates/src/debug-agent.cc
/branches/experimental/isolates/src/debug-agent.h
/branches/experimental/isolates/src/debug.cc
/branches/experimental/isolates/src/frames-inl.h
/branches/experimental/isolates/src/frames.cc
/branches/experimental/isolates/src/frames.h
/branches/experimental/isolates/src/full-codegen.cc
/branches/experimental/isolates/src/isolate.cc
/branches/experimental/isolates/src/isolate.h
/branches/experimental/isolates/src/liveedit.cc
/branches/experimental/isolates/src/log-utils.cc
/branches/experimental/isolates/src/log-utils.h
/branches/experimental/isolates/src/log.cc
/branches/experimental/isolates/src/log.h
/branches/experimental/isolates/src/mark-compact.cc
/branches/experimental/isolates/src/parser.cc
/branches/experimental/isolates/src/platform-posix.cc
/branches/experimental/isolates/src/platform-win32.cc
/branches/experimental/isolates/src/platform.h
/branches/experimental/isolates/src/profile-generator.cc
/branches/experimental/isolates/src/profile-generator.h
/branches/experimental/isolates/src/runtime.cc
/branches/experimental/isolates/src/runtime.h
/branches/experimental/isolates/src/token.cc
/branches/experimental/isolates/src/token.h
/branches/experimental/isolates/src/top.cc
/branches/experimental/isolates/src/unicode.cc
/branches/experimental/isolates/src/unicode.h
/branches/experimental/isolates/src/version.h
/branches/experimental/isolates/test/cctest/test-accessors.cc
=======================================
--- /branches/experimental/isolates/src/ast.h Thu Oct 14 20:21:08 2010
+++ /branches/experimental/isolates/src/ast.h Tue Oct 26 06:47:55 2010
@@ -1149,20 +1149,20 @@
class CallRuntime: public Expression {
public:
CallRuntime(Handle<String> name,
- Runtime::Function* function,
+ const Runtime::Function* function,
ZoneList<Expression*>* arguments)
: name_(name), function_(function), arguments_(arguments) { }
DECLARE_NODE_TYPE(CallRuntime)
Handle<String> name() const { return name_; }
- Runtime::Function* function() const { return function_; }
+ const Runtime::Function* function() const { return function_; }
ZoneList<Expression*>* arguments() const { return arguments_; }
bool is_jsruntime() const { return function_ == NULL; }
private:
Handle<String> name_;
- Runtime::Function* function_;
+ const Runtime::Function* function_;
ZoneList<Expression*>* arguments_;
};
=======================================
--- /branches/experimental/isolates/src/codegen.cc Thu Oct 14 20:21:08 2010
+++ /branches/experimental/isolates/src/codegen.cc Tue Oct 26 06:47:55 2010
@@ -379,7 +379,7 @@
bool CodeGenerator::CheckForInlineRuntimeCall(CallRuntime* node) {
ZoneList<Expression*>* args = node->arguments();
Handle<String> name = node->name();
- Runtime::Function* function = node->function();
+ const Runtime::Function* function = node->function();
if (function != NULL && function->intrinsic_type == Runtime::INLINE) {
InlineFunctionGenerator generator =
FindInlineFunctionGenerator(function->function_id);
=======================================
--- /branches/experimental/isolates/src/compiler.cc Thu Oct 14 20:21:08 2010
+++ /branches/experimental/isolates/src/compiler.cc Tue Oct 26 06:47:55 2010
@@ -169,8 +169,9 @@
if (!it.done()) {
script->set_eval_from_shared(
JSFunction::cast(it.frame()->function())->shared());
+ Code* code = it.frame()->LookupCode(isolate);
int offset = static_cast<int>(
- it.frame()->pc() - it.frame()->code()->instruction_start());
+ it.frame()->pc() - code->instruction_start());
script->set_eval_from_instructions_offset(Smi::FromInt(offset));
}
}
=======================================
--- /branches/experimental/isolates/src/debug-agent.cc Fri Jul 16 10:48:57
2010
+++ /branches/experimental/isolates/src/debug-agent.cc Tue Oct 26 06:47:55
2010
@@ -206,8 +206,8 @@
}
-const char* DebuggerAgentUtil::kContentLength = "Content-Length";
-int DebuggerAgentUtil::kContentLengthSize =
+const char* const DebuggerAgentUtil::kContentLength = "Content-Length";
+const int DebuggerAgentUtil::kContentLengthSize =
StrLength(kContentLength);
=======================================
--- /branches/experimental/isolates/src/debug-agent.h Fri Jul 16 10:48:57
2010
+++ /branches/experimental/isolates/src/debug-agent.h Tue Oct 26 06:47:55
2010
@@ -108,8 +108,8 @@
// Utility methods factored out to be used by the D8 shell as well.
class DebuggerAgentUtil {
public:
- static const char* kContentLength;
- static int kContentLengthSize;
+ static const char* const kContentLength;
+ static const int kContentLengthSize;
static SmartPointer<char> ReceiveMessage(const Socket* conn);
static bool SendConnectMessage(const Socket* conn,
=======================================
--- /branches/experimental/isolates/src/debug.cc Tue Oct 19 07:22:59 2010
+++ /branches/experimental/isolates/src/debug.cc Tue Oct 26 06:47:55 2010
@@ -1764,7 +1764,7 @@
Handle<Code> original_code(debug_info->original_code());
#ifdef DEBUG
// Get the code which is actually executing.
- Handle<Code> frame_code(frame->code());
+ Handle<Code> frame_code(frame->LookupCode(Isolate::Current()));
ASSERT(frame_code.is_identical_to(code));
#endif
@@ -1846,7 +1846,7 @@
Handle<Code> code(debug_info->code());
#ifdef DEBUG
// Get the code which is actually executing.
- Handle<Code> frame_code(frame->code());
+ Handle<Code> frame_code(frame->LookupCode(Isolate::Current()));
ASSERT(frame_code.is_identical_to(code));
#endif
=======================================
--- /branches/experimental/isolates/src/frames-inl.h Thu Sep 9 17:53:48
2010
+++ /branches/experimental/isolates/src/frames-inl.h Tue Oct 26 06:47:55
2010
@@ -30,6 +30,8 @@
#include "frames.h"
+#include "isolate.h"
+
#if V8_TARGET_ARCH_IA32
#include "ia32/frames-ia32.h"
#elif V8_TARGET_ARCH_X64
@@ -89,6 +91,11 @@
inline StackHandler* StackFrame::top_handler() const {
return iterator_->handler();
}
+
+
+inline Code* StackFrame::GetContainingCode(Isolate* isolate, Address pc) {
+ return isolate->pc_to_code_cache()->GetCacheEntry(pc)->code;
+}
inline Object* StandardFrame::GetExpression(int index) const {
=======================================
--- /branches/experimental/isolates/src/frames.cc Fri Sep 24 17:27:22 2010
+++ /branches/experimental/isolates/src/frames.cc Tue Oct 26 06:47:55 2010
@@ -35,8 +35,6 @@
namespace v8 {
namespace internal {
-PcToCodeCache::PcToCodeCacheEntry
- PcToCodeCache::cache_[PcToCodeCache::kPcToCodeCacheSize];
int SafeStackFrameIterator::active_count_ = 0;
@@ -426,7 +424,7 @@
void ExitFrame::Iterate(ObjectVisitor* v) const {
// The arguments are traversed as part of the expression stack of
// the calling frame.
- IteratePc(v, pc_address(), code());
+ IteratePc(v, pc_address(), LookupCode(Isolate::Current()));
v->VisitPointer(&code_slot());
}
@@ -760,14 +758,14 @@
ASSERT(!it.done());
StackHandler* handler = it.handler();
ASSERT(handler->is_entry());
- handler->Iterate(v, code());
+ handler->Iterate(v, LookupCode(Isolate::Current()));
#ifdef DEBUG
// Make sure that the entry frame does not contain more than one
// stack handler.
it.Advance();
ASSERT(it.done());
#endif
- IteratePc(v, pc_address(), code());
+ IteratePc(v, pc_address(), LookupCode(Isolate::Current()));
}
@@ -784,7 +782,7 @@
v->VisitPointers(base, reinterpret_cast<Object**>(address));
base = reinterpret_cast<Object**>(address +
StackHandlerConstants::kSize);
// Traverse the pointers in the handler itself.
- handler->Iterate(v, code());
+ handler->Iterate(v, LookupCode(Isolate::Current()));
}
v->VisitPointers(base, limit);
}
@@ -792,7 +790,7 @@
void JavaScriptFrame::Iterate(ObjectVisitor* v) const {
IterateExpressions(v);
- IteratePc(v, pc_address(), code());
+ IteratePc(v, pc_address(), LookupCode(Isolate::Current()));
// Traverse callee-saved registers, receiver, and parameters.
const int kBaseOffset = JavaScriptFrameConstants::kSavedRegistersOffset;
@@ -807,7 +805,7 @@
// Internal frames only have object pointers on the expression stack
// as they never have any arguments.
IterateExpressions(v);
- IteratePc(v, pc_address(), code());
+ IteratePc(v, pc_address(), LookupCode(Isolate::Current()));
}
@@ -837,7 +835,7 @@
Code* PcToCodeCache::GcSafeFindCodeForPc(Address pc) {
- Heap* heap = HEAP;
+ Heap* heap = isolate_->heap();
// Check if the pc points into a large object chunk.
LargeObjectChunk* chunk = heap->lo_space()->FindChunkContainingPc(pc);
if (chunk != NULL) return GcSafeCastToCode(chunk->GetObject(), pc);
=======================================
--- /branches/experimental/isolates/src/frames.h Fri Sep 24 17:27:22 2010
+++ /branches/experimental/isolates/src/frames.h Tue Oct 26 06:47:55 2010
@@ -43,31 +43,35 @@
// Forward declarations.
class StackFrameIterator;
class ThreadLocalTop;
-
-
-class PcToCodeCache : AllStatic {
+class Isolate;
+
+class PcToCodeCache {
public:
struct PcToCodeCacheEntry {
Address pc;
Code* code;
};
- static PcToCodeCacheEntry* cache(int index) {
- return &cache_[index];
- }
-
- static Code* GcSafeFindCodeForPc(Address pc);
- static Code* GcSafeCastToCode(HeapObject* object, Address pc);
-
- static void FlushPcToCodeCache() {
+ explicit PcToCodeCache(Isolate* isolate) : isolate_(isolate) {}
+
+ Code* GcSafeFindCodeForPc(Address pc);
+ Code* GcSafeCastToCode(HeapObject* object, Address pc);
+
+ void Flush() {
memset(&cache_[0], 0, sizeof(cache_));
}
- static PcToCodeCacheEntry* GetCacheEntry(Address pc);
+ PcToCodeCacheEntry* GetCacheEntry(Address pc);
private:
+ PcToCodeCacheEntry* cache(int index) { return &cache_[index]; }
+
+ Isolate* isolate_;
+
static const int kPcToCodeCacheSize = 1024;
- static PcToCodeCacheEntry cache_[kPcToCodeCacheSize];
+ PcToCodeCacheEntry cache_[kPcToCodeCacheSize];
+
+ DISALLOW_COPY_AND_ASSIGN(PcToCodeCache);
};
@@ -189,12 +193,12 @@
virtual Code* unchecked_code() const = 0;
// Get the code associated with this frame.
- Code* code() const { return GetContainingCode(pc()); }
+ Code* LookupCode(Isolate* isolate) const {
+ return GetContainingCode(isolate, pc());
+ }
// Get the code object that contains the given pc.
- Code* GetContainingCode(Address pc) const {
- return PcToCodeCache::GetCacheEntry(pc)->code;
- }
+ static inline Code* GetContainingCode(Isolate* isolate, Address pc);
virtual void Iterate(ObjectVisitor* v) const = 0;
static void IteratePc(ObjectVisitor* v, Address* pc_address, Code*
holder);
=======================================
--- /branches/experimental/isolates/src/full-codegen.cc Thu Oct 14 20:21:08
2010
+++ /branches/experimental/isolates/src/full-codegen.cc Tue Oct 26 06:47:55
2010
@@ -593,7 +593,7 @@
void FullCodeGenerator::EmitInlineRuntimeCall(CallRuntime* node) {
ZoneList<Expression*>* args = node->arguments();
Handle<String> name = node->name();
- Runtime::Function* function = node->function();
+ const Runtime::Function* function = node->function();
ASSERT(function != NULL);
ASSERT(function->intrinsic_type == Runtime::INLINE);
InlineFunctionGenerator generator =
=======================================
--- /branches/experimental/isolates/src/isolate.cc Thu Oct 7 01:42:25 2010
+++ /branches/experimental/isolates/src/isolate.cc Tue Oct 26 06:47:55 2010
@@ -337,6 +337,7 @@
in_use_list_(0),
free_list_(0),
preallocated_storage_preallocated_(false),
+ pc_to_code_cache_(NULL),
write_input_buffer_(NULL),
global_handles_(NULL),
context_switcher_(NULL),
@@ -487,6 +488,8 @@
compilation_cache_ = NULL;
delete bootstrapper_;
bootstrapper_ = NULL;
+ delete pc_to_code_cache_;
+ pc_to_code_cache_ = NULL;
delete write_input_buffer_;
write_input_buffer_ = NULL;
@@ -554,6 +557,7 @@
context_slot_cache_ = new ContextSlotCache();
descriptor_lookup_cache_ = new DescriptorLookupCache();
scanner_character_classes_ = new ScannerCharacterClasses();
+ pc_to_code_cache_ = new PcToCodeCache(this);
write_input_buffer_ = new StringInputBuffer();
global_handles_ = new GlobalHandles();
bootstrapper_ = new Bootstrapper();
=======================================
--- /branches/experimental/isolates/src/isolate.h Tue Oct 19 07:22:59 2010
+++ /branches/experimental/isolates/src/isolate.h Tue Oct 26 06:47:55 2010
@@ -33,7 +33,6 @@
#include "builtins.h"
#include "contexts.h"
#include "execution.h"
-#include "frames-inl.h"
#include "frames.h"
#include "global-handles.h"
#include "handles.h"
@@ -704,6 +703,8 @@
ScannerCharacterClasses* scanner_character_classes() {
return scanner_character_classes_;
}
+
+ PcToCodeCache* pc_to_code_cache() { return pc_to_code_cache_; }
StringInputBuffer* write_input_buffer() { return write_input_buffer_; }
@@ -975,6 +976,7 @@
PreallocatedStorage in_use_list_;
PreallocatedStorage free_list_;
bool preallocated_storage_preallocated_;
+ PcToCodeCache* pc_to_code_cache_;
StringInputBuffer* write_input_buffer_;
GlobalHandles* global_handles_;
ContextSwitcher* context_switcher_;
@@ -1198,5 +1200,6 @@
// they're needed.
#include "allocation-inl.h"
#include "zone-inl.h"
+#include "frames-inl.h"
#endif // V8_ISOLATE_H_
=======================================
--- /branches/experimental/isolates/src/liveedit.cc Thu Oct 14 20:21:08 2010
+++ /branches/experimental/isolates/src/liveedit.cc Tue Oct 26 06:47:55 2010
@@ -1148,7 +1148,7 @@
Handle<SharedFunctionInfo> shared(
SharedFunctionInfo::cast(wrapper->value()));
- if (frame->code() == shared->code()) {
+ if (frame->LookupCode(Isolate::Current()) == shared->code()) {
SetElement(result, i, Handle<Smi>(Smi::FromInt(status)));
return true;
}
@@ -1198,21 +1198,22 @@
ASSERT(bottom_js_frame->is_java_script());
// Check the nature of the top frame.
- if (pre_top_frame->code()->is_inline_cache_stub() &&
- pre_top_frame->code()->ic_state() == DEBUG_BREAK) {
+ Code* pre_top_frame_code = pre_top_frame->LookupCode(Isolate::Current());
+ if (pre_top_frame_code->is_inline_cache_stub() &&
+ pre_top_frame_code->ic_state() == DEBUG_BREAK) {
// OK, we can drop inline cache calls.
*mode = Debug::FRAME_DROPPED_IN_IC_CALL;
- } else if (pre_top_frame->code() ==
+ } else if (pre_top_frame_code ==
Isolate::Current()->debug()->debug_break_slot()) {
// OK, we can drop debug break slot.
*mode = Debug::FRAME_DROPPED_IN_DEBUG_SLOT_CALL;
- } else if (pre_top_frame->code() ==
+ } else if (pre_top_frame_code ==
Isolate::Current()->builtins()->builtin(
Builtins::FrameDropper_LiveEdit)) {
// OK, we can drop our own code.
*mode = Debug::FRAME_DROPPED_IN_DIRECT_CALL;
- } else if (pre_top_frame->code()->kind() == Code::STUB &&
- pre_top_frame->code()->major_key()) {
+ } else if (pre_top_frame_code->kind() == Code::STUB &&
+ pre_top_frame_code->major_key()) {
// Entry from our unit tests, it's fine, we support this case.
*mode = Debug::FRAME_DROPPED_IN_DIRECT_CALL;
} else {
=======================================
--- /branches/experimental/isolates/src/log-utils.cc Wed Jul 7 10:51:10
2010
+++ /branches/experimental/isolates/src/log-utils.cc Tue Oct 26 06:47:55
2010
@@ -120,7 +120,7 @@
}
// Must be the same message as in Logger::PauseProfiler.
-const char* Log::kDynamicBufferSeal = "profiler,\"pause\"\n";
+const char* const Log::kDynamicBufferSeal = "profiler,\"pause\"\n";
Log::Log(Logger* logger)
: write_to_file_(false),
@@ -439,11 +439,11 @@
// Formatting string for back references to the whole line. E.g. "#2" means
// "the second line above".
-const char* LogRecordCompressor::kLineBackwardReferenceFormat = "#%d";
+const char* const LogRecordCompressor::kLineBackwardReferenceFormat
= "#%d";
// Formatting string for back references. E.g. "#2:10" means
// "the second line above, start from char 10 (0-based)".
-const char* LogRecordCompressor::kBackwardReferenceFormat = "#%d:%d";
+const char* const LogRecordCompressor::kBackwardReferenceFormat = "#%d:%d";
LogRecordCompressor::~LogRecordCompressor() {
=======================================
--- /branches/experimental/isolates/src/log-utils.h Thu Oct 14 20:21:08 2010
+++ /branches/experimental/isolates/src/log-utils.h Tue Oct 26 06:47:55 2010
@@ -163,7 +163,7 @@
static const int kMaxDynamicBufferSize = 50 * 1024 * 1024;
// Message to "seal" dynamic buffer with.
- static const char* kDynamicBufferSeal;
+ static const char* const kDynamicBufferSeal;
// mutex_ is a Mutex used for enforcing exclusive
// access to the formatting buffer and the log file or log memory buffer.
@@ -210,8 +210,8 @@
static const int kNoCompressionWindowSize = 2;
// Formatting strings for back references.
- static const char* kLineBackwardReferenceFormat;
- static const char* kBackwardReferenceFormat;
+ static const char* const kLineBackwardReferenceFormat;
+ static const char* const kBackwardReferenceFormat;
static int GetBackwardReferenceSize(int distance, int pos);
=======================================
--- /branches/experimental/isolates/src/log.cc Thu Oct 14 20:21:08 2010
+++ /branches/experimental/isolates/src/log.cc Tue Oct 26 06:47:55 2010
@@ -344,13 +344,14 @@
}
#define DECLARE_LONG_EVENT(ignore1, long_name, ignore2) long_name,
-const char* kLongLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = {
+static const char* const kLongLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS]
= {
LOG_EVENTS_AND_TAGS_LIST(DECLARE_LONG_EVENT)
};
#undef DECLARE_LONG_EVENT
#define DECLARE_SHORT_EVENT(ignore1, ignore2, short_name) short_name,
-const char* kCompressedLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = {
+static const char* const
+kCompressedLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = {
LOG_EVENTS_AND_TAGS_LIST(DECLARE_SHORT_EVENT)
};
#undef DECLARE_SHORT_EVENT
@@ -911,14 +912,13 @@
// This function can be called from GC iterators (during Scavenge,
// MC, and MS), so marking bits can be set on objects. That's
// why unchecked accessors are used here.
- static Address prev_code = NULL;
if (!log_->IsEnabled() || !FLAG_log_code) return;
LogMessageBuilder msg(this);
msg.Append("%s,", log_events_[FUNCTION_CREATION_EVENT]);
msg.AppendAddress(function->address());
msg.Append(',');
- msg.AppendAddress(function->unchecked_code()->address(), prev_code);
- prev_code = function->unchecked_code()->address();
+ msg.AppendAddress(function->unchecked_code()->address(), prev_code_);
+ prev_code_ = function->unchecked_code()->address();
if (FLAG_compress_log) {
ASSERT(compression_helper_ != NULL);
if (!compression_helper_->HandleMessage(&msg)) return;
=======================================
--- /branches/experimental/isolates/src/log.h Thu Oct 14 20:21:08 2010
+++ /branches/experimental/isolates/src/log.h Tue Oct 26 06:47:55 2010
@@ -351,7 +351,7 @@
SlidingStateWindow* sliding_state_window_;
// An array of log events names.
- const char** log_events_;
+ const char* const* log_events_;
// An instance of helper created if log compression is enabled.
CompressionHelper* compression_helper_;
=======================================
--- /branches/experimental/isolates/src/mark-compact.cc Thu Oct 21 16:41:09
2010
+++ /branches/experimental/isolates/src/mark-compact.cc Tue Oct 26 06:47:55
2010
@@ -88,12 +88,12 @@
heap_->MarkMapPointersAsEncoded(true);
UpdatePointers();
heap_->MarkMapPointersAsEncoded(false);
- PcToCodeCache::FlushPcToCodeCache();
+ heap_->isolate()->pc_to_code_cache()->Flush();
RelocateObjects();
} else {
SweepSpaces();
- PcToCodeCache::FlushPcToCodeCache();
+ heap_->isolate()->pc_to_code_cache()->Flush();
}
Finish();
=======================================
--- /branches/experimental/isolates/src/parser.cc Thu Oct 14 20:21:08 2010
+++ /branches/experimental/isolates/src/parser.cc Tue Oct 26 06:47:55 2010
@@ -4040,7 +4040,7 @@
top_scope_->ForceEagerCompilation();
}
- Runtime::Function* function = Runtime::FunctionForSymbol(name);
+ const Runtime::Function* function = Runtime::FunctionForSymbol(name);
// Check for built-in IS_VAR macro.
if (function != NULL &&
=======================================
--- /branches/experimental/isolates/src/platform-posix.cc Wed Sep 1
10:01:38 2010
+++ /branches/experimental/isolates/src/platform-posix.cc Tue Oct 26
06:47:55 2010
@@ -122,7 +122,7 @@
}
-const char* OS::LogFileOpenMode = "w";
+const char* const OS::LogFileOpenMode = "w";
void OS::Print(const char* format, ...) {
=======================================
--- /branches/experimental/isolates/src/platform-win32.cc Wed Sep 1
10:01:38 2010
+++ /branches/experimental/isolates/src/platform-win32.cc Tue Oct 26
06:47:55 2010
@@ -726,7 +726,7 @@
// Open log file in binary mode to avoid /n -> /r/n conversion.
-const char* OS::LogFileOpenMode = "wb";
+const char* const OS::LogFileOpenMode = "wb";
// Print (debug) message to console.
=======================================
--- /branches/experimental/isolates/src/platform.h Thu Sep 9 17:53:48 2010
+++ /branches/experimental/isolates/src/platform.h Tue Oct 26 06:47:55 2010
@@ -171,7 +171,7 @@
static FILE* FOpen(const char* path, const char* mode);
// Log file open mode is platform-dependent due to line ends issues.
- static const char* LogFileOpenMode;
+ static const char* const LogFileOpenMode;
// Print output to console. This is mostly used for debugging output.
// On platforms that has standard terminal output, the output
=======================================
--- /branches/experimental/isolates/src/profile-generator.cc Thu Oct 14
20:21:08 2010
+++ /branches/experimental/isolates/src/profile-generator.cc Tue Oct 26
06:47:55 2010
@@ -122,7 +122,7 @@
}
-const char* CodeEntry::kEmptyNamePrefix = "";
+const char* const CodeEntry::kEmptyNamePrefix = "";
void CodeEntry::CopyData(const CodeEntry& source) {
@@ -760,10 +760,12 @@
}
-const char* ProfileGenerator::kAnonymousFunctionName = "(anonymous
function)";
-const char* ProfileGenerator::kProgramEntryName = "(program)";
-const char* ProfileGenerator::kGarbageCollectorEntryName =
- "(garbage collector)";
+const char* const ProfileGenerator::kAnonymousFunctionName =
+ "(anonymous function)";
+const char* const ProfileGenerator::kProgramEntryName =
+ "(program)";
+const char* const ProfileGenerator::kGarbageCollectorEntryName =
+ "(garbage collector)";
ProfileGenerator::ProfileGenerator(CpuProfilesCollection* profiles)
=======================================
--- /branches/experimental/isolates/src/profile-generator.h Thu Oct 14
20:21:08 2010
+++ /branches/experimental/isolates/src/profile-generator.h Tue Oct 26
06:47:55 2010
@@ -108,7 +108,7 @@
uint32_t GetCallUid() const;
bool IsSameAs(CodeEntry* entry) const;
- static const char* kEmptyNamePrefix;
+ static const char* const kEmptyNamePrefix;
private:
Logger::LogEventsAndTags tag_;
@@ -411,9 +411,9 @@
return sample_rate_calc_.ticks_per_ms();
}
- static const char* kAnonymousFunctionName;
- static const char* kProgramEntryName;
- static const char* kGarbageCollectorEntryName;
+ static const char* const kAnonymousFunctionName;
+ static const char* const kProgramEntryName;
+ static const char* const kGarbageCollectorEntryName;
private:
INLINE(CodeEntry* EntryForVMState(StateTag tag));
=======================================
--- /branches/experimental/isolates/src/runtime.cc Thu Oct 21 16:41:09 2010
+++ /branches/experimental/isolates/src/runtime.cc Tue Oct 26 06:47:55 2010
@@ -7404,7 +7404,7 @@
RUNTIME_ASSERT(IsAligned(size, kPointerSize));
RUNTIME_ASSERT(size > 0);
Heap* heap = isolate->heap();
- static const int kMinFreeNewSpaceAfterGC = heap->InitialSemiSpaceSize()
* 3/4;
+ const int kMinFreeNewSpaceAfterGC = heap->InitialSemiSpaceSize() * 3/4;
RUNTIME_ASSERT(size <= kMinFreeNewSpaceAfterGC);
Object* allocation = heap->new_space()->AllocateRaw(size);
if (!allocation->IsFailure()) {
@@ -8408,7 +8408,8 @@
Handle<Object> frame_id(WrapFrameId(it.frame()->id()), isolate);
// Find source position.
- int position = it.frame()->code()->SourcePosition(it.frame()->pc());
+ int position =
+ it.frame()->LookupCode(isolate)->SourcePosition(it.frame()->pc());
// Check for constructor frame.
bool constructor = it.frame()->IsConstructor();
@@ -9481,9 +9482,8 @@
}
-static const char* source_str =
+static const char kSourceStr[] =
"(function(arguments,__source__){return eval(__source__);})";
-static const int source_str_length = StrLength(source_str);
// Evaluate a piece of JavaScript in the context of a stack frame for
@@ -9566,11 +9566,10 @@
// 'arguments'. This it to have access to what would have
been 'arguments' in
// the function being debugged.
// function(arguments,__source__) {return eval(__source__);}
- ASSERT(source_str_length == StrLength(source_str));
Handle<String> function_source =
isolate->factory()->NewStringFromAscii(
- Vector<const char>(source_str, source_str_length));
+ Vector<const char>(kSourceStr, sizeof(kSourceStr) - 1));
Handle<SharedFunctionInfo> shared =
Compiler::CompileEval(function_source,
context,
@@ -10346,7 +10345,7 @@
Object* recv = frame->receiver();
Object* fun = frame->function();
Address pc = frame->pc();
- Address start = frame->code()->address();
+ Address start = frame->LookupCode(isolate)->address();
Smi* offset = Smi::FromInt(static_cast<int>(pc - start));
FixedArray* elements = FixedArray::cast(result->elements());
if (cursor + 2 < elements->length()) {
@@ -10560,7 +10559,7 @@
{ Runtime::kInline##name, Runtime::INLINE, \
"_" #name, NULL, number_of_args, result_size },
-Runtime::Function kIntrinsicFunctions[] = {
+static const Runtime::Function kIntrinsicFunctions[] = {
RUNTIME_FUNCTION_LIST(F)
INLINE_FUNCTION_LIST(I)
INLINE_RUNTIME_FUNCTION_LIST(I)
@@ -10586,7 +10585,7 @@
}
-Runtime::Function* Runtime::FunctionForSymbol(Handle<String> name) {
+const Runtime::Function* Runtime::FunctionForSymbol(Handle<String> name) {
Heap* heap = HEAP;
int entry = heap->intrinsic_function_names()->FindEntry(*name);
if (entry != kNotFound) {
@@ -10598,7 +10597,7 @@
}
-Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
+const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
return &(kIntrinsicFunctions[static_cast<int>(id)]);
}
=======================================
--- /branches/experimental/isolates/src/runtime.h Thu Oct 14 20:21:08 2010
+++ /branches/experimental/isolates/src/runtime.h Tue Oct 26 06:47:55 2010
@@ -544,10 +544,10 @@
Object* dictionary);
// Get the intrinsic function with the given name, which must be a
symbol.
- static Function* FunctionForSymbol(Handle<String> name);
+ static const Function* FunctionForSymbol(Handle<String> name);
// Get the intrinsic function with the given FunctionId.
- static Function* FunctionForId(FunctionId id);
+ static const Function* FunctionForId(FunctionId id);
// General-purpose helper functions for runtime system.
static int StringMatch(Isolate* isolate,
=======================================
--- /branches/experimental/isolates/src/token.cc Mon Aug 9 14:00:56 2010
+++ /branches/experimental/isolates/src/token.cc Tue Oct 26 06:47:55 2010
@@ -33,21 +33,21 @@
namespace internal {
#define T(name, string, precedence) #name,
-const char* Token::name_[NUM_TOKENS] = {
+const char* const Token::name_[NUM_TOKENS] = {
TOKEN_LIST(T, T, IGNORE_TOKEN)
};
#undef T
#define T(name, string, precedence) string,
-const char* Token::string_[NUM_TOKENS] = {
+const char* const Token::string_[NUM_TOKENS] = {
TOKEN_LIST(T, T, IGNORE_TOKEN)
};
#undef T
#define T(name, string, precedence) precedence,
-int8_t Token::precedence_[NUM_TOKENS] = {
+const int8_t Token::precedence_[NUM_TOKENS] = {
TOKEN_LIST(T, T, IGNORE_TOKEN)
};
#undef T
=======================================
--- /branches/experimental/isolates/src/token.h Thu Sep 9 17:53:48 2010
+++ /branches/experimental/isolates/src/token.h Tue Oct 26 06:47:55 2010
@@ -268,9 +268,9 @@
}
private:
- static const char* name_[NUM_TOKENS];
- static const char* string_[NUM_TOKENS];
- static int8_t precedence_[NUM_TOKENS];
+ static const char* const name_[NUM_TOKENS];
+ static const char* const string_[NUM_TOKENS];
+ static const int8_t precedence_[NUM_TOKENS];
static const char token_type[NUM_TOKENS];
};
=======================================
--- /branches/experimental/isolates/src/top.cc Thu Oct 14 20:21:08 2010
+++ /branches/experimental/isolates/src/top.cc Tue Oct 26 06:47:55 2010
@@ -191,7 +191,7 @@
if (options & StackTrace::kLineNumber) {
int script_line_offset = script->line_offset()->value();
- int position = frame->code()->SourcePosition(frame->pc());
+ int position = frame->LookupCode(this)->SourcePosition(frame->pc());
int line_number = GetScriptLineNumber(script, position);
// line_number is already shifted by the script_line_offset.
int relative_line_number = line_number - script_line_offset;
@@ -549,7 +549,7 @@
HandleScope scope;
// Find code position if recorded in relocation info.
JavaScriptFrame* frame = it.frame();
- int pos = frame->code()->SourcePosition(frame->pc());
+ int pos = frame->LookupCode(this)->SourcePosition(frame->pc());
Handle<Object> pos_obj(Smi::FromInt(pos));
// Fetch function and receiver.
Handle<JSFunction> fun(JSFunction::cast(frame->function()));
@@ -580,7 +580,7 @@
Object* script = fun->shared()->script();
if (script->IsScript() &&
!(Script::cast(script)->source()->IsUndefined())) {
- int pos = frame->code()->SourcePosition(frame->pc());
+ int pos = frame->LookupCode(this)->SourcePosition(frame->pc());
// Compute the location from the function and the reloc info.
Handle<Script> casted_script(Script::cast(script));
*target = MessageLocation(casted_script, pos, pos + 1);
=======================================
--- /branches/experimental/isolates/src/unicode.cc Mon Aug 9 14:00:56 2010
+++ /branches/experimental/isolates/src/unicode.cc Tue Oct 26 06:47:55 2010
@@ -1570,7 +1570,7 @@
}
-uchar UnicodeData::kMaxCodePoint = 65533;
+const uchar UnicodeData::kMaxCodePoint = 65533;
int UnicodeData::GetByteCount() {
return kUppercaseTable0Size * sizeof(int32_t) // NOLINT
=======================================
--- /branches/experimental/isolates/src/unicode.h Fri Sep 24 17:27:22 2010
+++ /branches/experimental/isolates/src/unicode.h Tue Oct 26 06:47:55 2010
@@ -97,7 +97,7 @@
private:
friend class Test;
static int GetByteCount();
- static uchar kMaxCodePoint;
+ static const uchar kMaxCodePoint;
};
// --- U t f 8 ---
=======================================
--- /branches/experimental/isolates/src/version.h Thu Jun 24 09:41:05 2010
+++ /branches/experimental/isolates/src/version.h Tue Oct 26 06:47:55 2010
@@ -49,6 +49,7 @@
static const char* GetVersion() { return version_string_; }
private:
+ // NOTE: can't make these really const because of test-version.cc.
static int major_;
static int minor_;
static int build_;
=======================================
--- /branches/experimental/isolates/test/cctest/test-accessors.cc Thu Jun
10 10:14:01 2010
+++ /branches/experimental/isolates/test/cctest/test-accessors.cc Tue Oct
26 06:47:55 2010
@@ -397,9 +397,9 @@
for (int i = 0; !iter.done(); i++) {
i::StackFrame* frame = iter.frame();
CHECK(i != 0 || (frame->type() == i::StackFrame::EXIT));
- CHECK(frame->code()->IsCode());
+ i::Code* code = frame->LookupCode(i::Isolate::Current());
+ CHECK(code->IsCode());
i::Address pc = frame->pc();
- i::Code* code = frame->code();
CHECK(code->contains(pc));
iter.Advance();
}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev