Permalink
Browse files

Merge commit 'upstream/3.1.8.26'

  • Loading branch information...
2 parents 0f43783 + e2b4141 commit e21844fca3c7e66f90d89db4acfd3fa43af905a9 @kapouer kapouer committed Aug 2, 2011
View
4 src/arm/lithium-arm.cc
@@ -1936,6 +1936,10 @@ LInstruction* LChunkBuilder::DoParameter(HParameter* instr) {
LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) {
int spill_index = chunk()->GetNextSpillIndex(false); // Not double-width.
+ if (spill_index > LUnallocated::kMaxFixedIndex) {
+ Abort("Too many spill slots needed for OSR");
+ spill_index = 0;
+ }
return DefineAsSpilled(new LUnknownOSRValue, spill_index);
}
View
10 src/compiler.cc
@@ -1,4 +1,4 @@
-// Copyright 2010 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:
@@ -223,10 +223,12 @@ static bool MakeCrankshaftCode(CompilationInfo* info) {
//
// The encoding is as a signed value, with parameters and receiver using
// the negative indices and locals the non-negative ones.
- const int limit = LUnallocated::kMaxFixedIndices / 2;
+ const int parameter_limit = -LUnallocated::kMinFixedIndex;
+ const int locals_limit = LUnallocated::kMaxFixedIndex;
Scope* scope = info->scope();
- if ((scope->num_parameters() + 1) > limit ||
- scope->num_stack_slots() > limit) {
+ if ((scope->num_parameters() + 1) > parameter_limit ||
+ (info->osr_ast_id() != AstNode::kNoNumber &&
+ scope->num_parameters() + 1 + scope->num_stack_slots() > locals_limit)) {
AbortAndDisable(info);
// True indicates the compilation pipeline is still going, not
// necessarily that we optimized the code.
View
8 src/ia32/full-codegen-ia32.cc
@@ -2772,8 +2772,12 @@ void FullCodeGenerator::EmitMathPow(ZoneList<Expression*>* args) {
VisitForStackValue(args->at(0));
VisitForStackValue(args->at(1));
- MathPowStub stub;
- __ CallStub(&stub);
+ if (CpuFeatures::IsSupported(SSE2)) {
+ MathPowStub stub;
+ __ CallStub(&stub);
+ } else {
+ __ CallRuntime(Runtime::kMath_pow, 2);
+ }
context()->Plug(eax);
}
View
4 src/ia32/lithium-ia32.cc
@@ -1986,6 +1986,10 @@ LInstruction* LChunkBuilder::DoParameter(HParameter* instr) {
LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) {
int spill_index = chunk()->GetNextSpillIndex(false); // Not double-width.
+ if (spill_index > LUnallocated::kMaxFixedIndex) {
+ Abort("Too many spill slots needed for OSR");
+ spill_index = 0;
+ }
return DefineAsSpilled(new LUnknownOSRValue, spill_index);
}
View
3 src/lithium.h
@@ -143,7 +143,8 @@ class LUnallocated: public LOperand {
};
static const int kMaxVirtualRegisters = 1 << (kVirtualRegisterWidth + 1);
- static const int kMaxFixedIndices = 128;
+ static const int kMaxFixedIndex = 63;
+ static const int kMinFixedIndex = -64;
bool HasIgnorePolicy() const { return policy() == IGNORE; }
bool HasNoPolicy() const { return policy() == NONE; }
View
1 src/messages.js
@@ -211,6 +211,7 @@ function FormatMessage(message) {
invalid_preparser_data: ["Invalid preparser data for function ", "%0"],
strict_mode_with: ["Strict mode code may not include a with statement"],
strict_catch_variable: ["Catch variable may not be eval or arguments in strict mode"],
+ too_many_arguments: ["Too many arguments in function call (only 32766 allowed)"],
too_many_parameters: ["Too many parameters in function definition"],
strict_param_name: ["Parameter name eval or arguments is not allowed in strict mode"],
strict_param_dupe: ["Strict mode function may not have duplicate parameter names"],
View
6 src/parser.cc
@@ -3490,6 +3490,12 @@ ZoneList<Expression*>* Parser::ParseArguments(bool* ok) {
while (!done) {
Expression* argument = ParseAssignmentExpression(true, CHECK_OK);
result->Add(argument);
+ if (result->length() > kMaxNumFunctionParameters) {
+ ReportMessageAt(scanner().location(), "too_many_arguments",
+ Vector<const char*>::empty());
+ *ok = false;
+ return NULL;
+ }
done = (peek() == Token::RPAREN);
if (!done) Expect(Token::COMMA, CHECK_OK);
}
View
5 src/platform-solaris.cc
@@ -1,4 +1,4 @@
-// Copyright 2006-2009 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:
@@ -105,7 +105,8 @@ uint64_t OS::CpuFeaturesImpliedByPlatform() {
int OS::ActivationFrameAlignment() {
- return STACK_ALIGN;
+ // GCC generates code that requires 16 byte alignment such as movdqa.
+ return Max(STACK_ALIGN, 16);
}
View
2 src/version.cc
@@ -35,7 +35,7 @@
#define MAJOR_VERSION 3
#define MINOR_VERSION 1
#define BUILD_NUMBER 8
-#define PATCH_LEVEL 22
+#define PATCH_LEVEL 26
#define CANDIDATE_VERSION false
// Define SONAME to have the SCons build the put a specific SONAME into the
View
4 src/x64/lithium-x64.cc
@@ -1939,6 +1939,10 @@ LInstruction* LChunkBuilder::DoParameter(HParameter* instr) {
LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) {
int spill_index = chunk()->GetNextSpillIndex(false); // Not double-width.
+ if (spill_index > LUnallocated::kMaxFixedIndex) {
+ Abort("Too many spill slots needed for OSR");
+ spill_index = 0;
+ }
return DefineAsSpilled(new LUnknownOSRValue, spill_index);
}
View
33 test/mjsunit/regress/regress-1122.js
@@ -25,12 +25,14 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Test that we can handle functions with up to 32766 arguments, and that
-// functions with more arguments throw an exception.
+// Test that we can handle function calls with up to 32766 arguments, and
+// that function calls with more arguments throw an exception. Apply a
+// similar limit to the number of function parameters.
-// See http://code.google.com/p/v8/issues/detail?id=1122.
+// See http://code.google.com/p/v8/issues/detail?id=1122 and
+// http://code.google.com/p/v8/issues/detail?id=1413.
-function function_with_n_args(n) {
+function function_with_n_params_and_m_args(n, m) {
test_prefix = 'prefix ';
test_suffix = ' suffix';
var source = 'test_prefix + (function f(';
@@ -39,17 +41,28 @@ function function_with_n_args(n) {
source += 'arg' + arg;
}
source += ') { return arg' + (n - n % 2) / 2 + '; })(';
- for (var arg = 0; arg < n ; arg++) {
+ for (var arg = 0; arg < m ; arg++) {
if (arg != 0) source += ',';
source += arg;
}
source += ') + test_suffix';
return eval(source);
}
-assertEquals('prefix 4000 suffix', function_with_n_args(8000));
-assertEquals('prefix 9000 suffix', function_with_n_args(18000));
-assertEquals('prefix 16000 suffix', function_with_n_args(32000));
+assertEquals('prefix 4000 suffix',
+ function_with_n_params_and_m_args(8000, 8000));
+assertEquals('prefix 3000 suffix',
+ function_with_n_params_and_m_args(6000, 8000));
+assertEquals('prefix 5000 suffix',
+ function_with_n_params_and_m_args(10000, 8000));
+assertEquals('prefix 9000 suffix',
+ function_with_n_params_and_m_args(18000, 18000));
+assertEquals('prefix 16000 suffix',
+ function_with_n_params_and_m_args(32000, 32000));
+assertEquals('prefix undefined suffix',
+ function_with_n_params_and_m_args(32000, 10000));
-assertThrows("function_with_n_args(35000)");
-assertThrows("function_with_n_args(100000)");
+assertThrows("function_with_n_params_and_m_args(35000, 35000)");
+assertThrows("function_with_n_params_and_m_args(100000, 100000)");
+assertThrows("function_with_n_params_and_m_args(35000, 30000)");
+assertThrows("function_with_n_params_and_m_args(30000, 35000)");

0 comments on commit e21844f

Please sign in to comment.