Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 58 global->Set(v8::String::New("read"), v8::FunctionTemplate::New(Read)); | 58 global->Set(v8::String::New("read"), v8::FunctionTemplate::New(Read)); |
| 59 // Bind the global 'load' function to the C++ Load callback. | 59 // Bind the global 'load' function to the C++ Load callback. |
| 60 global->Set(v8::String::New("load"), v8::FunctionTemplate::New(Load)); | 60 global->Set(v8::String::New("load"), v8::FunctionTemplate::New(Load)); |
| 61 // Bind the 'quit' function | 61 // Bind the 'quit' function |
| 62 global->Set(v8::String::New("quit"), v8::FunctionTemplate::New(Quit)); | 62 global->Set(v8::String::New("quit"), v8::FunctionTemplate::New(Quit)); |
| 63 // Bind the 'version' function | 63 // Bind the 'version' function |
| 64 global->Set(v8::String::New("version"), v8::FunctionTemplate::New(Version)); | 64 global->Set(v8::String::New("version"), v8::FunctionTemplate::New(Version)); |
| 65 // Create a new execution environment containing the built-in | 65 // Create a new execution environment containing the built-in |
| 66 // functions | 66 // functions |
| 67 v8::Persistent<v8::Context> context = v8::Context::New(NULL, global); | 67 v8::Persistent<v8::Context> context = v8::Context::New(NULL, global); |
| 68 if (context.IsEmpty()) { | |
| 69 printf("Error creating context\n"); | |
| 70 return 1; | |
|
Lasse Reichstein
2011/03/10 11:58:48
Thank you! Thank you!
| |
| 71 } | |
| 72 | |
| 68 bool run_shell = (argc == 1); | 73 bool run_shell = (argc == 1); |
| 69 for (int i = 1; i < argc; i++) { | 74 for (int i = 1; i < argc; i++) { |
| 70 // Enter the execution environment before evaluating any code. | 75 // Enter the execution environment before evaluating any code. |
| 71 v8::Context::Scope context_scope(context); | 76 v8::Context::Scope context_scope(context); |
| 72 const char* str = argv[i]; | 77 const char* str = argv[i]; |
| 73 if (strcmp(str, "--shell") == 0) { | 78 if (strcmp(str, "--shell") == 0) { |
| 74 run_shell = true; | 79 run_shell = true; |
| 75 } else if (strcmp(str, "-f") == 0) { | 80 } else if (strcmp(str, "-f") == 0) { |
| 76 // Ignore any -f flags for compatibility with the other stand- | 81 // Ignore any -f flags for compatibility with the other stand- |
| 77 // alone JavaScript engines. | 82 // alone JavaScript engines. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 v8::Testing::SetStressRunType(FLAG_stress_opt | 137 v8::Testing::SetStressRunType(FLAG_stress_opt |
| 133 ? v8::Testing::kStressTypeOpt | 138 ? v8::Testing::kStressTypeOpt |
| 134 : v8::Testing::kStressTypeDeopt); | 139 : v8::Testing::kStressTypeDeopt); |
| 135 int stress_runs = v8::Testing::GetStressRuns(); | 140 int stress_runs = v8::Testing::GetStressRuns(); |
| 136 for (int i = 0; i < stress_runs && result == 0; i++) { | 141 for (int i = 0; i < stress_runs && result == 0; i++) { |
| 137 printf("============ Stress %d/%d ============\n", | 142 printf("============ Stress %d/%d ============\n", |
| 138 i + 1, stress_runs); | 143 i + 1, stress_runs); |
| 139 v8::Testing::PrepareStressRun(i); | 144 v8::Testing::PrepareStressRun(i); |
| 140 result = RunMain(argc, argv); | 145 result = RunMain(argc, argv); |
| 141 } | 146 } |
| 147 printf("======== Full Deoptimization =======\n"); | |
| 148 v8::Testing::DeoptimizeAll(); | |
|
Søren Thygesen Gjesse
2011/03/10 12:47:02
Regarding regression tests this added deoptimizati
| |
| 142 } else { | 149 } else { |
| 143 result = RunMain(argc, argv); | 150 result = RunMain(argc, argv); |
| 144 } | 151 } |
| 145 v8::V8::Dispose(); | 152 v8::V8::Dispose(); |
| 146 return result; | 153 return result; |
| 147 } | 154 } |
| 148 | 155 |
| 149 | 156 |
| 150 // Extracts a C string from a V8 Utf8Value. | 157 // Extracts a C string from a V8 Utf8Value. |
| 151 const char* ToCString(const v8::String::Utf8Value& value) { | 158 const char* ToCString(const v8::String::Utf8Value& value) { |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 340 printf("^"); | 347 printf("^"); |
| 341 } | 348 } |
| 342 printf("\n"); | 349 printf("\n"); |
| 343 v8::String::Utf8Value stack_trace(try_catch->StackTrace()); | 350 v8::String::Utf8Value stack_trace(try_catch->StackTrace()); |
| 344 if (stack_trace.length() > 0) { | 351 if (stack_trace.length() > 0) { |
| 345 const char* stack_trace_string = ToCString(stack_trace); | 352 const char* stack_trace_string = ToCString(stack_trace); |
| 346 printf("%s\n", stack_trace_string); | 353 printf("%s\n", stack_trace_string); |
| 347 } | 354 } |
| 348 } | 355 } |
| 349 } | 356 } |
| OLD | NEW |