// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "../include/v8stdint.h"
-
-#include "preparse-data-format.h"
-#include "preparse-data.h"
-
-#include "checks.h"
-#include "globals.h"
-#include "hashmap.h"
+#include "include/v8stdint.h"
+#include "src/base/logging.h"
+#include "src/compiler.h"
+#include "src/globals.h"
+#include "src/hashmap.h"
+#include "src/preparse-data.h"
+#include "src/preparse-data-format.h"
namespace v8 {
namespace internal {
preamble_[PreparseDataConstants::kHasErrorOffset] = false;
preamble_[PreparseDataConstants::kFunctionsSizeOffset] = 0;
preamble_[PreparseDataConstants::kSizeOffset] = 0;
- ASSERT_EQ(5, PreparseDataConstants::kHeaderSize);
+ DCHECK_EQ(5, PreparseDataConstants::kHeaderSize);
#ifdef DEBUG
prev_start_ = -1;
#endif
const char* message,
const char* arg_opt,
bool is_reference_error) {
- if (has_error()) return;
+ if (HasError()) return;
preamble_[PreparseDataConstants::kHasErrorOffset] = true;
function_store_.Reset();
STATIC_ASSERT(PreparseDataConstants::kMessageStartPos == 0);
}
-Vector<unsigned> CompleteParserRecorder::ExtractData() {
+ScriptData* CompleteParserRecorder::GetScriptData() {
int function_size = function_store_.size();
int total_size = PreparseDataConstants::kHeaderSize + function_size;
- Vector<unsigned> data = Vector<unsigned>::New(total_size);
+ unsigned* data = NewArray<unsigned>(total_size);
preamble_[PreparseDataConstants::kFunctionsSizeOffset] = function_size;
- OS::MemCopy(data.start(), preamble_, sizeof(preamble_));
+ MemCopy(data, preamble_, sizeof(preamble_));
if (function_size > 0) {
- function_store_.WriteTo(data.SubVector(PreparseDataConstants::kHeaderSize,
- total_size));
+ function_store_.WriteTo(Vector<unsigned>(
+ data + PreparseDataConstants::kHeaderSize, function_size));
}
- return data;
+ DCHECK(IsAligned(reinterpret_cast<intptr_t>(data), kPointerAlignment));
+ ScriptData* result = new ScriptData(reinterpret_cast<byte*>(data),
+ total_size * sizeof(unsigned));
+ result->AcquireDataOwnership();
+ return result;
}