Reviewers: mvstanton,
Message:
Ready for review
Description:
Move enum CompilationType from objects.h to include/v8.h,
so it is available for embedders (eg blink).
BUG=2844
Please review this at https://codereview.chromium.org/22831010/
SVN Base: git://github.com/v8/v8.git@master
Affected files:
M include/v8.h
M src/accessors.cc
M src/compiler.cc
M src/isolate.cc
M src/objects-inl.h
M src/objects.h
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index
3252602bcf19d8fabba52e0c7fbbd274615f7ff2..513ae1378bb910505f28e7240c5954a7af5e58d2
100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -978,6 +978,12 @@ class ScriptOrigin {
*/
class V8_EXPORT Script {
public:
+ // Script compilation types.
+ enum CompilationType {
+ COMPILATION_TYPE_HOST = 0,
+ COMPILATION_TYPE_EVAL = 1
+ };
+
/**
* Compiles the specified script (context-independent).
*
Index: src/accessors.cc
diff --git a/src/accessors.cc b/src/accessors.cc
index
a43eb78b8702d57ca504e734a38e1bc635582bec..c4dde5d59305110a7e2ab119eb7d7de7fd962401
100644
--- a/src/accessors.cc
+++ b/src/accessors.cc
@@ -388,7 +388,7 @@ MaybeObject*
Accessors::ScriptGetEvalFromScriptPosition(Object* object, void*) {
Handle<Script> script(raw_script);
// If this is not a script compiled through eval there is no eval
position.
- if (script->compilation_type() != Script::COMPILATION_TYPE_EVAL) {
+ if (script->compilation_type() != v8::Script::COMPILATION_TYPE_EVAL) {
return script->GetHeap()->undefined_value();
}
Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index
f6e5daac854228dec0381fdd64b317330109833b..18a780b6290fae541455ff542a16648f00462499
100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -570,7 +570,7 @@ static Handle<SharedFunctionInfo>
MakeFunctionInfo(CompilationInfo* info) {
#ifdef ENABLE_DEBUGGER_SUPPORT
if (info->is_eval()) {
- script->set_compilation_type(Script::COMPILATION_TYPE_EVAL);
+ script->set_compilation_type(v8::Script::COMPILATION_TYPE_EVAL);
// For eval scripts add information on the function from which eval was
// called.
if (info->is_eval()) {
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index
7b77d893f15451738d6ecada03a7eafa7ca600de..3b4b9d4712fc5a1b9287b56588251d891a3c974c
100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -817,7 +817,7 @@ Handle<JSArray> Isolate::CaptureCurrentStackTrace(
if (options & StackTrace::kIsEval) {
Handle<Object> is_eval =
- script->compilation_type() == Script::COMPILATION_TYPE_EVAL ?
+ script->compilation_type() ==
v8::Script::COMPILATION_TYPE_EVAL ?
factory()->true_value() : factory()->false_value();
CHECK_NOT_EMPTY_HANDLE(this,
JSObject::SetLocalPropertyIgnoreAttributes(
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index
169475791d05ff9672dfff163ba14dde0506bea5..dec57e4b910d44e164ae5cc52cf97384353a2ca5
100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -4508,13 +4508,13 @@ ACCESSORS_TO_SMI(Script,
eval_from_instructions_offset,
ACCESSORS_TO_SMI(Script, flags, kFlagsOffset)
BOOL_ACCESSORS(Script, flags, is_shared_cross_origin,
kIsSharedCrossOriginBit)
-Script::CompilationType Script::compilation_type() {
+v8::Script::CompilationType Script::compilation_type() {
return BooleanBit::get(flags(), kCompilationTypeBit) ?
- COMPILATION_TYPE_EVAL : COMPILATION_TYPE_HOST;
+ v8::Script::COMPILATION_TYPE_EVAL :
v8::Script::COMPILATION_TYPE_HOST;
}
-void Script::set_compilation_type(CompilationType type) {
+void Script::set_compilation_type(v8::Script::CompilationType type) {
set_flags(BooleanBit::set(flags(), kCompilationTypeBit,
- type == COMPILATION_TYPE_EVAL));
+ type == v8::Script::COMPILATION_TYPE_EVAL));
}
Script::CompilationState Script::compilation_state() {
return BooleanBit::get(flags(), kCompilationStateBit) ?
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index
f800c5d580eace363c14b94ac947af8cec798fc7..f46a3e96954b79a367072580e1b87ddafd80e774
100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -6083,12 +6083,6 @@ class Script: public Struct {
TYPE_NORMAL = 2
};
- // Script compilation types.
- enum CompilationType {
- COMPILATION_TYPE_HOST = 0,
- COMPILATION_TYPE_EVAL = 1
- };
-
// Script compilation state.
enum CompilationState {
COMPILATION_STATE_INITIAL = 0,
@@ -6139,8 +6133,8 @@ class Script: public Struct {
// [compilation_type]: how the the script was compiled. Encoded in the
// 'flags' field.
- inline CompilationType compilation_type();
- inline void set_compilation_type(CompilationType type);
+ inline v8::Script::CompilationType compilation_type();
+ inline void set_compilation_type(v8::Script::CompilationType type);
// [compilation_state]: determines whether the script has already been
// compiled. Encoded in the 'flags' field.
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.