Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Unified Diff: src/extensions/trigger-failure-extension.cc

Issue 105953005: Add tests and extension verifying CHECK and ASSERT. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed review comments. Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/extensions/trigger-failure-extension.h ('k') | src/flag-definitions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/extensions/trigger-failure-extension.cc
diff --git a/src/extensions/free-buffer-extension.cc b/src/extensions/trigger-failure-extension.cc
similarity index 57%
copy from src/extensions/free-buffer-extension.cc
copy to src/extensions/trigger-failure-extension.cc
index 5cf2b68146c9d325096b6f94172bca55d498c2fa..5fe6bbbf477a57696421f35dc41ad218bda1910e 100644
--- a/src/extensions/free-buffer-extension.cc
+++ b/src/extensions/trigger-failure-extension.cc
@@ -25,36 +25,58 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#include "free-buffer-extension.h"
-#include "platform.h"
+#include "trigger-failure-extension.h"
#include "v8.h"
namespace v8 {
namespace internal {
-v8::Handle<v8::FunctionTemplate> FreeBufferExtension::GetNativeFunctionTemplate(
+const char* const TriggerFailureExtension::kSource =
+ "native function triggerCheckFalse();"
+ "native function triggerAssertFalse();"
+ "native function triggerSlowAssertFalse();";
+
+
+v8::Handle<v8::FunctionTemplate>
+TriggerFailureExtension::GetNativeFunctionTemplate(
v8::Isolate* isolate,
v8::Handle<v8::String> str) {
- return v8::FunctionTemplate::New(FreeBufferExtension::FreeBuffer);
+ if (strcmp(*v8::String::Utf8Value(str), "triggerCheckFalse") == 0) {
+ return v8::FunctionTemplate::New(
+ TriggerFailureExtension::TriggerCheckFalse);
+ } else if (strcmp(*v8::String::Utf8Value(str), "triggerAssertFalse") == 0) {
+ return v8::FunctionTemplate::New(
+ TriggerFailureExtension::TriggerAssertFalse);
+ } else {
+ CHECK_EQ(0, strcmp(*v8::String::Utf8Value(str), "triggerSlowAssertFalse"));
+ return v8::FunctionTemplate::New(
+ TriggerFailureExtension::TriggerSlowAssertFalse);
+ }
}
-void FreeBufferExtension::FreeBuffer(
+void TriggerFailureExtension::TriggerCheckFalse(
const v8::FunctionCallbackInfo<v8::Value>& args) {
- v8::Handle<v8::ArrayBuffer> arrayBuffer = args[0].As<v8::ArrayBuffer>();
- v8::ArrayBuffer::Contents contents = arrayBuffer->Externalize();
- V8::ArrayBufferAllocator()->Free(contents.Data(), contents.ByteLength());
+ CHECK(false);
}
-void FreeBufferExtension::Register() {
- static char buffer[100];
- Vector<char> temp_vector(buffer, sizeof(buffer));
- OS::SNPrintF(temp_vector, "native function freeBuffer();");
+void TriggerFailureExtension::TriggerAssertFalse(
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
+ ASSERT(false);
+}
+
+
+void TriggerFailureExtension::TriggerSlowAssertFalse(
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
+ SLOW_ASSERT(false);
+}
+
- static FreeBufferExtension buffer_free_extension(buffer);
- static v8::DeclareExtension declaration(&buffer_free_extension);
+void TriggerFailureExtension::Register() {
+ static TriggerFailureExtension trigger_failure_extension;
+ static v8::DeclareExtension declaration(&trigger_failure_extension);
}
} } // namespace v8::internal
« no previous file with comments | « src/extensions/trigger-failure-extension.h ('k') | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698