OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 19845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19856 LocalContext context; | 19856 LocalContext context; |
19857 v8::HandleScope scope(context->GetIsolate()); | 19857 v8::HandleScope scope(context->GetIsolate()); |
19858 Local<FunctionTemplate> templ = FunctionTemplate::New(DummyCallHandler); | 19858 Local<FunctionTemplate> templ = FunctionTemplate::New(DummyCallHandler); |
19859 CompileRun("for (var i = 0; i < 128; i++) Object.prototype[i] = 0;"); | 19859 CompileRun("for (var i = 0; i < 128; i++) Object.prototype[i] = 0;"); |
19860 Local<Function> function = templ->GetFunction(); | 19860 Local<Function> function = templ->GetFunction(); |
19861 CHECK(!function.IsEmpty()); | 19861 CHECK(!function.IsEmpty()); |
19862 CHECK(function->IsFunction()); | 19862 CHECK(function->IsFunction()); |
19863 } | 19863 } |
19864 | 19864 |
19865 | 19865 |
19866 THREADED_TEST(JSONParse) { | 19866 THREADED_TEST(JSONParseObject) { |
19867 LocalContext context; | 19867 LocalContext context; |
19868 HandleScope scope(context->GetIsolate()); | 19868 HandleScope scope(context->GetIsolate()); |
19869 Local<Object> obj = v8::JSON::Parse(v8_str("{\"x\":42}")); | 19869 Local<Value> obj = v8::JSON::Parse(v8_str("{\"x\":42}")); |
19870 Handle<Object> global = context->Global(); | 19870 Handle<Object> global = context->Global(); |
19871 global->Set(v8_str("obj"), obj); | 19871 global->Set(v8_str("obj"), obj); |
19872 ExpectString("JSON.stringify(obj)", "{\"x\":42}"); | 19872 ExpectString("JSON.stringify(obj)", "{\"x\":42}"); |
19873 } | 19873 } |
19874 | 19874 |
19875 | 19875 |
| 19876 THREADED_TEST(JSONParseNumber) { |
| 19877 LocalContext context; |
| 19878 HandleScope scope(context->GetIsolate()); |
| 19879 Local<Value> obj = v8::JSON::Parse(v8_str("42")); |
| 19880 Handle<Object> global = context->Global(); |
| 19881 global->Set(v8_str("obj"), obj); |
| 19882 ExpectString("JSON.stringify(obj)", "42"); |
| 19883 } |
| 19884 |
| 19885 |
19876 #ifndef WIN32 | 19886 #ifndef WIN32 |
19877 class ThreadInterruptTest { | 19887 class ThreadInterruptTest { |
19878 public: | 19888 public: |
19879 ThreadInterruptTest() : sem_(NULL), sem_value_(0) { } | 19889 ThreadInterruptTest() : sem_(NULL), sem_value_(0) { } |
19880 ~ThreadInterruptTest() { delete sem_; } | 19890 ~ThreadInterruptTest() { delete sem_; } |
19881 | 19891 |
19882 void RunTest() { | 19892 void RunTest() { |
19883 sem_ = i::OS::CreateSemaphore(0); | 19893 sem_ = i::OS::CreateSemaphore(0); |
19884 | 19894 |
19885 InterruptThread i_thread(this); | 19895 InterruptThread i_thread(this); |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20105 CheckCorrectThrow("%HasProperty(other, 'x')"); | 20115 CheckCorrectThrow("%HasProperty(other, 'x')"); |
20106 CheckCorrectThrow("%HasElement(other, 1)"); | 20116 CheckCorrectThrow("%HasElement(other, 1)"); |
20107 CheckCorrectThrow("%IsPropertyEnumerable(other, 'x')"); | 20117 CheckCorrectThrow("%IsPropertyEnumerable(other, 'x')"); |
20108 CheckCorrectThrow("%GetPropertyNames(other)"); | 20118 CheckCorrectThrow("%GetPropertyNames(other)"); |
20109 CheckCorrectThrow("%GetLocalPropertyNames(other, true)"); | 20119 CheckCorrectThrow("%GetLocalPropertyNames(other, true)"); |
20110 CheckCorrectThrow("%DefineOrRedefineAccessorProperty(" | 20120 CheckCorrectThrow("%DefineOrRedefineAccessorProperty(" |
20111 "other, 'x', null, null, 1)"); | 20121 "other, 'x', null, null, 1)"); |
20112 } | 20122 } |
20113 | 20123 |
20114 #endif // WIN32 | 20124 #endif // WIN32 |
OLD | NEW |