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 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1547 v8::Handle<Value> arguments_object = | 1547 v8::Handle<Value> arguments_object = |
1548 CompileRun("var out = 0; (function(){ out = arguments; })(1,2,3); out;"); | 1548 CompileRun("var out = 0; (function(){ out = arguments; })(1,2,3); out;"); |
1549 CHECK(arguments_object->IsArgumentsObject()); | 1549 CHECK(arguments_object->IsArgumentsObject()); |
1550 v8::Handle<Value> array = CompileRun("[1,2,3]"); | 1550 v8::Handle<Value> array = CompileRun("[1,2,3]"); |
1551 CHECK(!array->IsArgumentsObject()); | 1551 CHECK(!array->IsArgumentsObject()); |
1552 v8::Handle<Value> object = CompileRun("{a:42}"); | 1552 v8::Handle<Value> object = CompileRun("{a:42}"); |
1553 CHECK(!object->IsArgumentsObject()); | 1553 CHECK(!object->IsArgumentsObject()); |
1554 } | 1554 } |
1555 | 1555 |
1556 | 1556 |
| 1557 THREADED_TEST(IsMapOrSet) { |
| 1558 LocalContext env; |
| 1559 v8::HandleScope scope(env->GetIsolate()); |
| 1560 v8::Handle<Value> map = CompileRun("new Map()"); |
| 1561 v8::Handle<Value> set = CompileRun("new Set()"); |
| 1562 v8::Handle<Value> weak_map = CompileRun("new WeakMap()"); |
| 1563 v8::Handle<Value> weak_set = CompileRun("new WeakSet()"); |
| 1564 CHECK(map->IsMap()); |
| 1565 CHECK(set->IsSet()); |
| 1566 CHECK(weak_map->IsWeakMap()); |
| 1567 CHECK(weak_set->IsWeakSet()); |
| 1568 |
| 1569 CHECK(!map->IsSet()); |
| 1570 CHECK(!map->IsWeakMap()); |
| 1571 CHECK(!map->IsWeakSet()); |
| 1572 |
| 1573 CHECK(!set->IsMap()); |
| 1574 CHECK(!set->IsWeakMap()); |
| 1575 CHECK(!set->IsWeakSet()); |
| 1576 |
| 1577 CHECK(!weak_map->IsMap()); |
| 1578 CHECK(!weak_map->IsSet()); |
| 1579 CHECK(!weak_map->IsWeakSet()); |
| 1580 |
| 1581 CHECK(!weak_set->IsMap()); |
| 1582 CHECK(!weak_set->IsSet()); |
| 1583 CHECK(!weak_set->IsWeakMap()); |
| 1584 |
| 1585 v8::Handle<Value> object = CompileRun("{a:42}"); |
| 1586 CHECK(!object->IsMap()); |
| 1587 CHECK(!object->IsSet()); |
| 1588 CHECK(!object->IsWeakMap()); |
| 1589 CHECK(!object->IsWeakSet()); |
| 1590 } |
| 1591 |
| 1592 |
1557 THREADED_TEST(StringObject) { | 1593 THREADED_TEST(StringObject) { |
1558 LocalContext env; | 1594 LocalContext env; |
1559 v8::HandleScope scope(env->GetIsolate()); | 1595 v8::HandleScope scope(env->GetIsolate()); |
1560 v8::Handle<Value> boxed_string = CompileRun("new String(\"test\")"); | 1596 v8::Handle<Value> boxed_string = CompileRun("new String(\"test\")"); |
1561 CHECK(boxed_string->IsStringObject()); | 1597 CHECK(boxed_string->IsStringObject()); |
1562 v8::Handle<Value> unboxed_string = CompileRun("\"test\""); | 1598 v8::Handle<Value> unboxed_string = CompileRun("\"test\""); |
1563 CHECK(!unboxed_string->IsStringObject()); | 1599 CHECK(!unboxed_string->IsStringObject()); |
1564 v8::Handle<Value> boxed_not_string = CompileRun("new Number(42)"); | 1600 v8::Handle<Value> boxed_not_string = CompileRun("new Number(42)"); |
1565 CHECK(!boxed_not_string->IsStringObject()); | 1601 CHECK(!boxed_not_string->IsStringObject()); |
1566 v8::Handle<Value> not_object = CompileRun("0"); | 1602 v8::Handle<Value> not_object = CompileRun("0"); |
(...skipping 21309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
22876 desc = x->GetOwnPropertyDescriptor(v8_str("p1")); | 22912 desc = x->GetOwnPropertyDescriptor(v8_str("p1")); |
22877 Local<Function> set = | 22913 Local<Function> set = |
22878 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("set"))); | 22914 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("set"))); |
22879 Local<Function> get = | 22915 Local<Function> get = |
22880 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("get"))); | 22916 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("get"))); |
22881 CHECK_EQ(v8_num(13), get->Call(x, 0, NULL)); | 22917 CHECK_EQ(v8_num(13), get->Call(x, 0, NULL)); |
22882 Handle<Value> args[] = { v8_num(14) }; | 22918 Handle<Value> args[] = { v8_num(14) }; |
22883 set->Call(x, 1, args); | 22919 set->Call(x, 1, args); |
22884 CHECK_EQ(v8_num(14), get->Call(x, 0, NULL)); | 22920 CHECK_EQ(v8_num(14), get->Call(x, 0, NULL)); |
22885 } | 22921 } |
OLD | NEW |