Permalink
Browse files

Merge commit 'upstream/3.1.8.18'

Conflicts:
	src/version.cc
  • Loading branch information...
2 parents 3d6defa + bc5d4d3 commit 8a7fd38a009a40eee72460048f861ca8a1c31943 @kapouer kapouer committed May 23, 2011
@@ -3425,21 +3425,27 @@ void TypeRecordingBinaryOpStub::GenerateInt32Stub(MacroAssembler* masm) {
// Save the left value on the stack.
__ Push(r5, r4);
+ Label pop_and_call_runtime;
+
// Allocate a heap number to store the result.
heap_number_result = r5;
GenerateHeapResultAllocation(masm,
heap_number_result,
heap_number_map,
scratch1,
scratch2,
- &call_runtime);
+ &pop_and_call_runtime);
// Load the left value from the value saved on the stack.
__ Pop(r1, r0);
// Call the C function to handle the double operation.
FloatingPointHelper::CallCCodeForDoubleOperation(
masm, op_, heap_number_result, scratch1);
+
+ __ bind(&pop_and_call_runtime);
+ __ Drop(2);
+ __ b(&call_runtime);
}
break;
View
@@ -818,8 +818,8 @@ BUILTIN(ArraySplice) {
const int delta = actual_delete_count - item_count;
if (actual_start > 0) {
- Object** start = elms->data_start();
- memmove(start + delta, start, actual_start * kPointerSize);
+ AssertNoAllocation no_gc;
+ MoveElements(&no_gc, elms, delta, elms, 0, actual_start);
}
elms = LeftTrimFixedArray(elms, delta);
@@ -789,15 +789,33 @@ class HBlockEntry: public HTemplateInstruction<0> {
};
-class HDeoptimize: public HTemplateControlInstruction<0> {
+class HDeoptimize: public HControlInstruction {
public:
- HDeoptimize() : HTemplateControlInstruction<0>(NULL, NULL) { }
+ HDeoptimize(int environment_length)
+ : HControlInstruction(NULL, NULL),
+ values_(environment_length) { }
virtual Representation RequiredInputRepresentation(int index) const {
return Representation::None();
}
+ virtual int OperandCount() { return values_.length(); }
+ virtual HValue* OperandAt(int index) { return values_[index]; }
+
+ void AddEnvironmentValue(HValue* value) {
+ values_.Add(NULL);
+ SetOperandAt(values_.length() - 1, value);
+ }
+
DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize")
+
+ protected:
+ virtual void InternalSetOperandAt(int index, HValue* value) {
+ values_[index] = value;
+ }
+
+ private:
+ ZoneList<HValue*> values_;
};
View
@@ -113,6 +113,21 @@ void HBasicBlock::AddInstruction(HInstruction* instr) {
}
+HDeoptimize* HBasicBlock::CreateDeoptimize() {
+ ASSERT(HasEnvironment());
+ HEnvironment* environment = last_environment();
+
+ HDeoptimize* instr = new HDeoptimize(environment->length());
+
+ for (int i = 0; i < environment->length(); i++) {
+ HValue* val = environment->values()->at(i);
+ instr->AddEnvironmentValue(val);
+ }
+
+ return instr;
+}
+
+
HSimulate* HBasicBlock::CreateSimulate(int id) {
ASSERT(HasEnvironment());
HEnvironment* environment = last_environment();
@@ -2560,7 +2575,7 @@ void HGraphBuilder::VisitSwitchStatement(SwitchStatement* stmt) {
// If we have a non-smi compare clause, we deoptimize after trying
// all the previous compares.
if (num_smi_clauses < num_clauses) {
- last_false_block->Finish(new HDeoptimize);
+ last_false_block->FinishExitWithDeoptimization();
}
// Build statement blocks, connect them to their comparison block and
@@ -3230,7 +3245,7 @@ void HGraphBuilder::HandlePolymorphicStoreNamedField(Assignment* expr,
HSubgraph* default_graph = CreateBranchSubgraph(environment());
{ SubgraphScope scope(this, default_graph);
if (!needs_generic && FLAG_deoptimize_uncommon_cases) {
- default_graph->exit_block()->FinishExit(new HDeoptimize());
+ default_graph->exit_block()->FinishExitWithDeoptimization();
default_graph->set_exit_block(NULL);
} else {
HInstruction* instr = BuildStoreNamedGeneric(object, name, value);
@@ -3567,7 +3582,7 @@ void HGraphBuilder::HandlePolymorphicLoadNamedField(Property* expr,
HSubgraph* default_graph = CreateBranchSubgraph(environment());
{ SubgraphScope scope(this, default_graph);
if (!needs_generic && FLAG_deoptimize_uncommon_cases) {
- default_graph->exit_block()->FinishExit(new HDeoptimize());
+ default_graph->exit_block()->FinishExitWithDeoptimization();
default_graph->set_exit_block(NULL);
} else {
HInstruction* instr = BuildLoadNamedGeneric(object, expr);
@@ -3928,7 +3943,7 @@ void HGraphBuilder::HandlePolymorphicCallNamed(Call* expr,
HSubgraph* default_graph = CreateBranchSubgraph(environment());
{ SubgraphScope scope(this, default_graph);
if (!needs_generic && FLAG_deoptimize_uncommon_cases) {
- default_graph->exit_block()->FinishExit(new HDeoptimize());
+ default_graph->exit_block()->FinishExitWithDeoptimization();
default_graph->set_exit_block(NULL);
} else {
HContext* context = new HContext;
View
@@ -124,6 +124,10 @@ class HBasicBlock: public ZoneObject {
void AddSimulate(int id) { AddInstruction(CreateSimulate(id)); }
void AssignCommonDominator(HBasicBlock* other);
+ void FinishExitWithDeoptimization() {
+ FinishExit(CreateDeoptimize());
+ }
+
// Add the inlined function exit sequence, adding an HLeaveInlined
// instruction and updating the bailout environment.
void AddLeaveInlined(HValue* return_value, HBasicBlock* target);
@@ -146,6 +150,7 @@ class HBasicBlock: public ZoneObject {
void AddDominatedBlock(HBasicBlock* block);
HSimulate* CreateSimulate(int id);
+ HDeoptimize* CreateDeoptimize();
int block_id_;
HGraph* graph_;
View
@@ -585,6 +585,7 @@ enum CompareResult {
class StringStream;
class ObjectVisitor;
+class Failure;
struct ValueInfo : public Malloced {
ValueInfo() : type(FIRST_TYPE), ptr(NULL), str(NULL), number(0) { }
@@ -611,6 +612,10 @@ class MaybeObject BASE_EMBEDDED {
*obj = reinterpret_cast<Object*>(this);
return true;
}
+ inline Failure* ToFailureUnchecked() {
+ ASSERT(IsFailure());
+ return reinterpret_cast<Failure*>(this);
+ }
inline Object* ToObjectUnchecked() {
ASSERT(!IsFailure());
return reinterpret_cast<Object*>(this);
View
@@ -2625,7 +2625,7 @@ MUST_USE_RESULT static MaybeObject* StringReplaceRegExpWithEmptyString(
end = RegExpImpl::GetCapture(match_info_array, 1);
}
- int length = subject->length();
+ int length = subject_handle->length();
int new_length = length - (end - start);
if (new_length == 0) {
return Heap::empty_string();
View
@@ -1,4 +1,4 @@
-// Copyright 2006-2008 the V8 project authors. All rights reserved.
+// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -740,6 +740,7 @@ Failure* Top::ReThrow(MaybeObject* exception, MessageLocation* location) {
// Set the exception being re-thrown.
set_pending_exception(exception);
+ if (exception->IsFailure()) return exception->ToFailureUnchecked();
return Failure::Exception();
}
View
@@ -147,17 +147,6 @@ function GlobalEval(x) {
}
-// execScript for IE compatibility.
-function GlobalExecScript(expr, lang) {
- // NOTE: We don't care about the character casing.
- if (!lang || /javascript/i.test(lang)) {
- var f = %CompileString(ToString(expr));
- f.call(%GlobalReceiver(global));
- }
- return null;
-}
-
-
// ----------------------------------------------------------------------------
@@ -177,8 +166,7 @@ function SetupGlobal() {
"isFinite", GlobalIsFinite,
"parseInt", GlobalParseInt,
"parseFloat", GlobalParseFloat,
- "eval", GlobalEval,
- "execScript", GlobalExecScript
+ "eval", GlobalEval
));
}
View
@@ -35,7 +35,7 @@
#define MAJOR_VERSION 3
#define MINOR_VERSION 1
#define BUILD_NUMBER 8
-#define PATCH_LEVEL 10
+#define PATCH_LEVEL 18
#define CANDIDATE_VERSION false
// Define SONAME to have the SCons build the put a specific SONAME into the
@@ -1379,7 +1379,7 @@ void Assembler::jmp(NearLabel* L) {
EnsureSpace ensure_space(this);
last_pc_ = pc_;
if (L->is_bound()) {
- const int short_size = sizeof(int8_t);
+ const int short_size = 2;
int offs = L->pos() - pc_offset();
ASSERT(offs <= 0);
ASSERT(is_int8(offs - short_size));
@@ -128,6 +128,6 @@ var globalFunctions = [
"encodeURI", "encodeURIComponent", "Error", "TypeError",
"RangeError", "SyntaxError", "ReferenceError", "EvalError",
"URIError", "isNaN", "isFinite", "parseInt", "parseFloat",
- "eval", "execScript"];
+ "eval"];
TestFunctionNames(this, globalFunctions);
@@ -1,4 +1,4 @@
-// Copyright 2008 the V8 project authors. All rights reserved.
+// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -25,10 +25,34 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-var x = 0;
-execScript('x = 1', 'javascript');
-assertEquals(1, x);
+function g(y) { assertEquals(y, 12); }
-execScript('x = 2', 'JavaScript');
-assertEquals(2, x);
+var X = 0;
+function foo () {
+ var cnt = 0;
+ var l = -1;
+ var x = 0;
+ while (1) switch (l) {
+ case -1:
+ var y = x + 12;
+ l = 0;
+ break;
+ case 0:
+ // Loop for to hit OSR.
+ if (cnt++ < 10000000) {
+ l = 0;
+ break;
+ } else {
+ l = 1;
+ break;
+ }
+ case 1:
+ // This case will contain deoptimization
+ // because it has no type feedback.
+ g(y);
+ return;
+ };
+}
+
+foo();
@@ -1,4 +1,4 @@
-// Copyright 2008 the V8 project authors. All rights reserved.
+// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -25,9 +25,32 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Make sure that 'this' is bound to the global object when using
-// execScript.
+// Flags: --expose-gc
-var result;
-execScript("result = this");
-assertTrue(result === this);
+// Create array large enough to span several page regions.
+var a = new Array(500);
+
+// Fill it with values.
+for (var i = 0; i < a.length; i++) a[i] = {idx:i};
+
+// Force it into oldspace.
+gc();
+gc();
+
+// Array should be in old space now. Store young object into array.
+// Region will be marked.
+a[0] = {idx:0};
+
+// Delete elements a[2] .. a[201]. Internally we will use
+// trimming of backing store. a[0] a[1] will be moved to
+// memory location previously occupied by a[200] a[201].
+a.splice(2, 200);
+
+// Force gc and heap verification.
+gc();
+
+// Try accessing a[0].idx. It will segfault if write-barrier was accidentally
+// omitted.
+assertEquals(0, a[0].idx);
+assertEquals(1, a[1].idx);
+assertEquals(202, a[2].idx);

0 comments on commit 8a7fd38

Please sign in to comment.